I tried caching my data in the MVC side that is returned to the client via Json. Not sure why its running so slow to create these dropdownlist?
I do have 3 or 4 simlar controls on a page.
My code, how can I speed up the load?:
function GetAuditStatusTypeSelected(container, selected) {
var url = '/AMS/Audit/GetAuditStatusTypes';
$.ajax({
url: url,
type: 'post',
success: function (result) {
$.each(result, function (i, item) {
container.append($('<option/>').text(result[i].Audit_Status_Type).attr('value', result[i].Audit_Status_ID));
});
if (selected > 0) {
container.find('option[value="' + selected + '"]').attr("selected", true);
} else {
container.append($('<option selected />').text('').attr('value', '0'));
}
},
error: function (xhr, err) {
alert(url + ' : ' + formatErrorMessage(xhr, err));
}
});
}