jeudi 27 octobre 2016

Jquery ajax filter checkbox

I making a country/department/city filter with checkboxes and ajax calls.

enter image description here

When i select a country Argentina for example all the departments and cities are selected and when i select a department all cities inside that department are selected. This is working fine but when i clic Argentina it calls again the ifChanged tigger for all departments and cities.

$('input').on('ifChanged', function(event){
   // Ajax call
});

So when the event is tiggered the ajax call is executed lot of times because is tiggered again and again until it finished.

I need to call the ajax function when the last element in trigger is complete, is this possible? Thanks




Aucun commentaire:

Enregistrer un commentaire