我从 asp.net 页面发送请求,然后等待响应,通过 SetInterval 方法调用 GetCommand:
function GetCommand(id, sid) {
getCommandResponse = $.ajax({
type: "POST",
async: true,
url: "../WebServices/TSMConsole.asmx/GetCommand",
data: "{'param' : '" + id + "', 'sid' : '" + sid + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(result, status) {
AjaxFinishedGet(result, status);
getCommandResponse = null;
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
AjaxFailedGet(XMLHttpRequest, textStatus, errorThrown);
getCommandResponse = null;
}
});
}
在 AjaxFinishedGet(result, status) 我尝试提取我的数据:
function AjaxFinishedGet(xml, status) {
endDate = new Date();
if (xml.d.IsPending == 'false' || endDate - startDate > timeoutMSec) {
if (getCommand != null) {
window.clearInterval(getCommand);
getCommand = null;
WriteGetCommand(xml.d.Text);
$("#showajax").fadeOut("fast");
}
}
}
但是,如果文本大小超过 102330 字节 - 而不是 AjaxFinishedGet,则调用 AjaxFailedGet :(
我没有找到任何关于 ajax 响应数据大小的限制或关于 javascript 变量大小的信息,至少这样的变量可以毫无问题地保持 1MB。实际上 Text 可能包含 1MB 的数据...
问题出在哪里?