我正在进行AJAX调用,并以JSON数据的形式获取结果并进行处理,并将其显示为数据表格式。总记录数5600。 它可以在Chrome,FireFox,IE标准浏览器中使用。 它不支持IE兼容模式。
借助Fiddler工具进行分析:
打开提琴手工具,并以兼容模式(7、8、9、10和edge)运行IE11中的页面。数据正在正确加载。
能够在Fiddler工具和IE开发人员控制台中看到完整的5600行(“网络”选项卡->“响应主体”部分)。
Fiddler属性的值类似于“响应在传递到客户端之前已缓冲”。
[
{"Salary":12345.25,"Employee Age Limit":"0-17","Joining type":"Immediate","Joining date":"2010-01-19"},
{"Salary":24567.25,"Employee Age Limit":"0-20","Joining type":"Immediate","Joining date":"2010-01-20"},
... //Cant post 5600rows here
...
...
{"Salary":24567.25,"Employee Age Limit":"0-20","Joining type":"Immediate","Joining date":"2010-01-20"}
]
问题:
关闭Fiddler工具,我从IE11尝试了兼容模式(7、8、9、10和Edge),并检查了F12(开发人员工具->网络选项卡->响应正文)
我可以看到3500行而不是5600行,最后一行本身不完整。同样,我运行了页面,
我可以看到1500行而不是5600行,最后一行本身不完整的数据。再次出现2200行等。有一个解析错误,它具有错误功能。
[
...
...
... //I got 1036rows istead of 5600rows. 1036th rows also incomplete
{"Salary":12345.25,"Employee Age Limit":"0-17","Joining type":"Immediate","Joining date":"2010-01-19"},
{"Salary":24567.25,"Employee Age Limit":"0-20","Joining type":"Immediate","Joining date":"2010-01-20"},
{"Salary":5678.25,"Employee Age Limit":"0-25","Joining type":"Immediate","Joinin
(在Ajax + JQuery + JavaScrip中)在IE兼容模式下开始解析数据之前,是否可以缓冲完整响应?
代码:
function loadTable(dataItem, container){
...
...
$.ajax({
url: "/modules/Demo/services/ReportData",
type: "POST",
traditional: true,
data: {
param1: param1Array,
param2: calcArray,
},
success: function (data) {
processTableData(data,container);
$.ajax({
url: "/modules/Demo/services/ChartData",
type: "POST",
traditional: true,
data: {
des: emp,
quarter: third
},
success: function (data) {
genrateChart(data, container);
},
error: function () {
container.text("Error occure while populate the Chart.");
}
});
},
error: function(jqXHR, textStatus, errorThrown) {
container.text("Unable to load the data into table.");
$('#result').html('<p>status code: '+jqXHR.status+'</p><p>errorThrown: ' + errorThrown + '</p><p>jqXHR.responseText:</p><div>'+jqXHR.responseText + '</div>');
console.log('jqXHR:'); console.log(jqXHR);
console.log('textStatus:'); console.log(textStatus);
console.log('errorThrown:'); console.log(errorThrown);
}
});
}
错误:
jqXHR:
[object Object]{readyState: 4, responseText: "[ {"xyz ...", status: 200, statusText: "parsererror"}
[object Object]
{
[functions]: ,
readyState: 4,
{
status: 200,
statusText: "parsererror"}
textStatus:
parsererror
errorThrown:
[object Error]
{
message: "JSON.parse",
name: "SyntaxError"