正在根据国家/地区列表检索州列表,并根据所选州检索城市。我为此使用 JQuery 和 Ajax。第一个 jquery 函数被触发,但第二个 jquery 函数没有被触发,即使我已经正确指定了我的字段 id
$(document)
.ready(
function() {
$('#countryId').on('change',function(){
jQuery
.ajax({
error : function() {
$("#stateSelectBox")
.html(
"<span class='error'>Failed to load state!</span>");
},
success : function(results) {
$("#stateSelectBox")
.html(results);
}
});
});
$('#stateId').on('change',function(){
jQuery
.ajax({
error : function() {
$("#city")
.html(
"<span class='error'>Failed to load state!</span>");
},
success : function(results) {
$("#city")
.html(results);
}
});
});
});