The following code works flawlessly if I uncomment the "alert"s. This is what I've figured out for doing a set of cascading dropdowns where the user selects Country, then State, then City.
With the alerts uncommented, it's like the values haven't gotten updated yet. I've tried a lot of stuff, but I've had no luck. I'm sure I'm doing something stupid. Any help is greatly appreciated.
Thanks!
$(document).ready(function () {
$("#Country").change(function () {
$("#City").html("");
var id = $("#Country").val();
getStates(id);
// alert("CountryId = " + id);
var stateId = $("#State").val();
// alert("stateId = " + stateId);
var stateId = $("#State").val();
alert("stateId = " + stateId);
$(document).ready(function() {
getCities(stateId);
});
});
$("#State").change(function(){
var id = $("#State").val();
id = (id==null)?1:id;
getCities(id);
});
});
The following code works flawlessly if I uncomment the alertscontradictsWith the alerts uncommented, it's like the values haven't gotten updated yet.