Please add console.log(cities)
to check the response:
$.each(data, function (i, cities) {
console.log(cities); //add this...
items += "<option value='" + cities["citiesId"] + "'>" + cities["cityName"] + "</option>";
});
Then you will find the property name in response is camel case .
So you need change code like below(eg change cities["CitiesId"]
to cities["citiesId"]
):
items += "<option value='" + cities["citiesId"] + "'>" + cities["cityName"] + "</option>";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.