dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Attaching a listener?

  1. #1
    Join Date
    Apr 2012
    Posts
    113

    Attaching a listener?

    I have a call to get data with this:

    Code:
    $( "#prodsAutoSuggest" ).keypress(function() {
    var prodID = $('#prodsAutoSuggest').val();
    // Search process for the product
    $.ajax({ url: 'process.php',
    				data: { productID : prodID},
             		type: 'post',
             		success: function(output) {
    					if(output){
    						$( "div.prodContent" ).slideDown( "slow", function() {
    							$( "div.prodContent" ).css("display","inline");
    							$( "div.prodContent" ).html(output + "<br /><br />");
    							
    						});
    					}
    				}
    			});
    });
    
    $('.product_quickview').on( "click", function(){  
    alert('good');
    });
    in process.php:

    Code:
    $query = mysql_query("SELECT * 
    	FROM product_list_sub 
    	WHERE name LIKE '%".mysql_real_escape_string($prodID)."%'");	
    	if (mysql_affected_rows() > 0) {
    		while($row = mysql_fetch_array($query)){
    			$name=$row['name'];
    			$description=$row['description'];
    			$prodID = $row['id'];
    			$imagePath="images/products/".$row['imagePath'];
    			echo $name . " [<a href='#' rel='modal-profile' id='".$prodID."' class='product_quickview'>QUICKVIEW</a>]" . " <img src='".$imagePath."' width='100' height='100' title='".$name."' /><br />";
    		}
    	}
    When the results load, and I click on quickview, nothing happens. Do I have to re-attach a listener?

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,945
    Please ask here : http://www.webdeveloper.com/forum/fo...ch-as-JScript) its where JQuery belongs...
    STOP using $ prefix on JavaScript variable names...
    Please remember to wrap any code you have in forum tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles