I have a filter form which, when changed, fills the div container (#results) with new filtered results from the database. But after changing the filter, the Infinite Ajax Scroll plugin displays the results of the first search on the second page. In case of a change, I need to completely reset the old results and show only the new ones. I tried many solutions but did nothing. I know the methods there , but I canβt figure out how to use them in my code (check the comments).
$("select").on("change", function() {
setTimeout(function() {
ias.destroy();
}, 1000);
ias.bind();
filter();
});
var filter = function() {
var formData = form.serializeObject();
$.ajax({
url: "/libs/filterData.php",
type: "POST",
data: JSON.stringify(formData),
cache: false,
success: function(results) {
$("#results").html(results);
}
});
};
var ias = jQuery.ias({
container: "#results",
item: ".result",
pagination: ".page-nav",
next: ".page-nav a"
});
I also tried this solution , but it does not work.
A similar problem here .