This is how i am loading on page load state and city dropdown:
My Controller method:
This is the first method which is calling when page is
This is a correct approach, but you can simplify your javascript:
function loadCities(obj) {
$.getJSON("/Home/GetCities", function (data) {
var html = '';
$(data).each(function () {
html += ''
});
$("#ddlCity").html(html);
});
}
Further possible simplification: Add the default item (Select City) server-side, so your javascript will be smaller.