此问题已在PlayStation 3,4,Xbox360,Xbox 1上转载。所有版本的AjaxPro都存在此问题。
当发出Ajax请求(使用AjaxPro)时,服务器返回正确的内容。但是,回调函数中返回的对象是
{
"error":
{
"Message":"","Type":"ConnectFailure","Status":200},"value":null,
"request":
{
"method":"MethodName",
"args":
{
"Argument1":"1111","Argument2":"2222"
}
},
"context":null,"duration":18
}
}发布于 2017-01-25 15:06:24
在我的例子中,当使用AjaxPro和https、TLS 1.2、ECDHE_RSA和P-256密钥交换以及AES_256_GCM密码(IE11+、Chrome51+、Firefox49+ )时,我也会遇到同样的错误。检查你的这里)。它运行好与过时的AES_256_CBC与HMAC-SHA1密码。
问题是,在服务器响应(我不知道原因)之后,XMLHttpRequest.statusText属性是空的,而AjaxPro.Request.prototype.doStateChange方法(ajaxpro/core.ashx文件)期望"OK“将响应作为有效的:
var res = this.getEmptyRes();
if(this.xmlHttp.status == 200 && this.xmlHttp.statusText == "OK") {
res = this.createResponse(res);
} else {
res = this.createResponse(res, true);
res.error = {Message:this.xmlHttp.statusText,Type:"ConnectFailure",Status:this.xmlHttp.status};
}最后,我决定重写AjaxPro.Request.prototype.doStateChange方法,并允许this.xmlHttp.statusText中的空值。
我将这个脚本添加到受影响的页面:
$(function() {
if (typeof AjaxPro != 'undefined' && AjaxPro && AjaxPro.Request && AjaxPro.Request.prototype) {
AjaxPro.Request.prototype.doStateChange = function () {
this.onStateChanged(this.xmlHttp.readyState, this);
if (this.xmlHttp.readyState != 4 || !this.isRunning) {
return;
}
this.duration = new Date().getTime() - this.__start;
if (this.timeoutTimer != null) {
clearTimeout(this.timeoutTimer);
}
var res = this.getEmptyRes();
if (this.xmlHttp.status == 200 && (this.xmlHttp.statusText == "OK" || !this.xmlHttp.statusText)) {
res = this.createResponse(res);
} else {
res = this.createResponse(res, true);
res.error = { Message: this.xmlHttp.statusText, Type: "ConnectFailure", Status: this.xmlHttp.status };
}
this.endRequest(res);
};
}
});发布于 2018-09-22 22:27:13
建立在此之前的所有答案的基础上,并为其他寻找此问题的人提供参考--在我们的情况下,我们将其追溯到HTTP2协议(注意--我们是在HTTPS上进行测试;我不确定HTTP上是否有问题.)。
发布于 2014-09-22 19:31:02
对这个问题的提示是
"Message":""AjaxPro的core.ashx文件是使用core.js生成的
在core.js中,以下代码负责在接收到服务器响应时生成响应对象。
if (this.xmlHttp.status == 200 && this.xmlHttp.statusText == "OK") {
res = this.createResponse(res);
} else {
res = this.createResponse(res, true);
res.error = { Message: this.xmlHttp.statusText, Type: "ConnectFailure", Status: this.xmlHttp.status };
}由于某些原因,标识平台上的浏览器不会将xmlHttp.statusText返回为"OK“。相反,它是空的。这导致AjaxPro进入"ConnectionFailure“子句。
https://stackoverflow.com/questions/25981779
复制相似问题