我有asp.net插件,它是从ASP.NET web方法填充在jQuery中的。我能够看到的数据,因为它应该在IE9+,FF,Chrome如下图所示:
在IE8中,这是我得到的:
查看页面的源代码,我可以看到文本和值,但屏幕上显示的是空白值。这是我使用的Web方法:
[WebMethod]
public static List<TraceabilityData> fetchData(int orderlineBomId)
{
Assembly _ass = new Assembly();
Dictionary<string, string> List = new Dictionary<string, string>();
var values = new List<TraceabilityData>();
List = _ass.traceabilityDataset(orderlineBomId);
foreach (KeyValuePair<string, string> val in List)
{
values.Add(new TraceabilityData { Id = Convert.ToInt32(val.Key), Content = val.Value });
}
return values;
}
jQuery函数:
$.ajax({
type: "POST",
url: "Index.aspx/fetchData",
data: "{orderlineBomId: '" + orderlinebomid + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
var dropdown = $('#<%=ddlTraceability.ClientID %>');
dropdown.empty();
dropdown.append(new Option(" ", 0));
$.each(response.d, function (index, item) {
dropdown.append(new Option(item.Content, item.Id));
});
},
error: function (xhr, ajaxOptions, thrownError) {
console.log("Ajax Error");
alert(xhr.responseText);
}
});
接下来我可以尝试什么?
1条答案
按热度按时间sd2nnvve1#
你很接近了。在这种情况下,我用这个方法让IE8高兴
将成功回调函数更改为