- <script>
$("#region").change(function () {
$("#city").ajaxStart(function(){
$("#city").addOption("Loading", "Loading....");
})
$("#city").ajaxComplete(function(){
$("#city").removeOption("Loading");
})
$("#region option:selected").each(function () {
var region_select = $("#region").val();
var country_select = $("#country").val();
region_select = "findlocation.php?do=city®ion=" + region_select + "&country=" + country_select;
$("#city").removeOption(/./);
$("#city").ajaxAddOption(region_select, {}, false, 00000);
});
})
$("#country").change(function () {
$("#region").ajaxStart(function(){
$("#region").addOption("Loading", "Loading....");
})
$("#region").ajaxComplete(function(){
$("#region").removeOption("Loading");
})
$("#country option:selected").each(function () {
var country_select = $("#country").val();
country_select = "findlocation.php?do=region&country=" + country_select;
$("#region").removeOption(/./);
$("#region").ajaxAddOption(country_select, {}, false, 00000);
$("#city").removeOption(/./);
});
})
</script>
So the above code I have three select boxes(country, region, city). Everything is working correctly including the city ajax. However when I change the region this $("#region").ajaxStart(function(){ is called even though it is in the country.change function. I only want the ajax function to be called if the country changes not if the region changes. Ideas?
-