沒有看到您的代碼很難爲您提供準確的答案。但是,根據我所知道的情況,我可以假設這樣的事情會適合你:
$(function() {
$.getJSON("/Customer/GetCustomerTypes", null, function(data) {
//Selected CustomerType received from the Customer Controller... e.g. 123
var selectedCustomerType = <%=selectedCustomerType %>;
var dropdownList = $("#customerTypeList")[0]; //Id of the dropdown
$.each(data, function(index, optionData) {
var option = new Option(optionData.Text, optionData.Value);
if(optionData.Value == selectedCustomerType) {
$(option).attr('selected','selected');
}
if ($.browser.msie) {
dropdownList.add(option);
}
else {
dropdownList.add(option, null);
}
});
});
});