I have built a filter that works with checkboxes. When i check a box a div (form-result) changes with the results.
The problem is that the result only changes the first 2 times after i check a box, after that i have to refresh the page because otherwise the query doesn't do anything anymore.
I hope the problem is clear.
$(document).ready(function() {
$("input").on('change', function() {
var myform = document.getElementById("search");
var fd = new FormData(myform );
$.ajax({
url: "update.php",
data: fd,
cache: false,
processData: false,
contentType: false,
type: 'POST',
success: function (data) {
$(".form-result").html(data);
}
});
});
});
Input works with a while:
<form enctype="multipart/form-data" method="post" name="search" id="search">
<input type="checkbox" value="'.$menu['color'].'" '.((isset( $_SESSION['input'] ['color'][$nr1]))?' checked':"").' class="css-checkbox2" name="color['.$nr1.']" id="'.$nr1.'" />
</form>
Is there anyone that could help me to get on the right track?
Thanks in advance.