I have 5 drop-down boxes like(Country,State,District,Town,street).
When i select country,i am loading the (state,district,town,street) belong to the country.
my question is now i am making 4 separate ajax calls for this.
$('#Country').change(function(){
var procemessage = "<option value='0'> Please wait...</option>";
$("#State").html(procemessage).show();
var CountryId = $(this).val();
$.ajax({
url: '../Home/LoadStateForCountry?CountryId=' + CountryId,
success: function (result) {
var markup = "";
if (result.length < 1) {
markup = "<option value='0'>--Nothing to Select--</option>";
} else {
data = result;
markup = "<option value='0'>--Select--</option>";
for (var x = 0; x < data.length; x++) {
markup += "<option value=" + data[x].ValueId + ">" + data[x].DisplayText + "</option>";
}
}
$("#State").html(markup).show();
},
error: function (result) { }
});
});
$('#Country').change(function(){
//Load district
});
$('#Country').change(function(){
//Load town
});
$('#Country').change(funstion(){
//Load street
});
Is it right to do like this. or is there anyway to call it at once.
I am new to MVC. so please guide me.