进行 ajax 调用时 Safari 会出现错误
我有以下 ajax 调用:
some_function: function (s) {
var list = [];
$.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
url: this.ws_base() + "/webService/someFunction",
dataType: 'json',
data: JSON.stringify({ s: s }),
async: false,
success: function (data) {
list = JSON.parse(data.some_functionResult);
},
error: function (xhr, err) {
this.display_alert("some_function error - readyState: " + xhr.readyState + "\nstatus: " + xhr.status);
}
});
return list;
}
在桌面 chrome/firefox 上,这将返回 json 格式的长字符串。这是我们所期望的。
在移动 Safari 中,这将返回到 ReadyState 0 status 0 的错误条件,
我认为必须存在某种语法问题,Chrome/FF 可以处理,但在 IOS 中会导致错误函数运行?
在我的组织中,在 IOS 上进行测试很困难,因此任何对此的见解将不胜感激。
I have the following ajax call:
some_function: function (s) {
var list = [];
$.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
url: this.ws_base() + "/webService/someFunction",
dataType: 'json',
data: JSON.stringify({ s: s }),
async: false,
success: function (data) {
list = JSON.parse(data.some_functionResult);
},
error: function (xhr, err) {
this.display_alert("some_function error - readyState: " + xhr.readyState + "\nstatus: " + xhr.status);
}
});
return list;
}
On desktop chrome/firefox this will return a long string in json format. Which is what is expected.
In mobile Safari this will return go to the error condition with readyState 0 status 0
I think there has to be some sort of syntax hiccup that Chrome/FF is fine with but in IOS causes the error function to run?
Testing on IOS is hard at my org, so any insight on this would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论