Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
JavaScript
function getProductFilterOptions(){
        var opts = [];
        $checkboxes.each(function(){
          if(this.checked){
			  	
            opts.push(this.id);
          }
        });

        return opts;
      }

function updateProduct(opts){
	$.ajax({
			type: "POST",
			url: "submit.php",
			dataType : 'json',
			cache: false,
			data: {filterOpts: opts},
			success: function(data){
			$('#disp').html(makeTable(data));
			$("#disp").table("refresh");
			
          }
        });
}

var $checkboxes = $("input:checkbox");
$checkboxes.on("change", function(){
	
		var opts = getProductFilterOptions();
        updateProduct(opts);
      });
	  updateProduct();
	  //dropdown();
$checkboxes.trigger("change");
Posted
Updated 13-Aug-15 22:59pm
v3
Comments
ZurdoDev 14-Aug-15 9:08am    
I don't understand your question but all you have to do is debug the code. Also, add in an error: function in your ajax call so that you can catch any error that's thrown.
Yogesh1214 14-Aug-15 9:59am    
I debug whole code, it is correct but javascript not working propraly why it is.
ZurdoDev 14-Aug-15 10:04am    
I don't know what you mean by "not working properly."
Yogesh1214 14-Aug-15 10:07am    
my submit.php is this is it correct

prepare($sql);
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
$json = json_encode($results);
echo($json);

?>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900