我正在进行ajax调用。它在当地工作正常。将应用程序部署到环境后,ajax调用将中止。即,我可以看到以下错误:
XMLHttpRequest:网络错误0x2eff,由于错误00002eff无法完成操作。
请参阅下面的ajax请求代码:
var refreshThisDiv = "idDiv";
var postUrl = "/UserData/getAllUserNames?id=" + id;
var httpRequest = null;
var refreshContent = "null";
httpRequest = XMLHTTPObject();
httpRequest.open("POST", postUrl, true);
httpRequest.onreadystatechange = function() {
doAjax(refreshThisDiv, httpRequest);
};
httpRequest.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
httpRequest.send(null);
function doAjax(refreshThisDiv, httpRequest) {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) `enter code here` {
var response = httpRequest.responseText;
if (response != 'null') {
//do Something
}
else {
//ajax failed
}
它始终是// ajax失败了。我不知道是什么问题,因为我无法在控制台中看到任何错误。