为什么这在黑莓上不起作用
我有一个可以在 Android、iPhone、Blackberry torch 和 webkit 浏览器上运行的 ajax 函数。我试图在各种版本 5 和 6 黑莓模拟器上测试这一点,但错误处理程序总是被调用。
例如,消息框中的响应是:错误、完成。
函数返回的错误是: “错误-状态:错误 jqXHR 状态:0 ResponseText:”
而所有其他设备是:成功完成。
我需要为黑莓做一些特别的事情吗?
$(document).ready(function () {
//Login form Login link click
$("#login a.login").click(function () {
//Call the approve method on the code behind
$.ajax({
type: "POST",
url: "Login.aspx/LoginUser",
data: "{'Username':'admin', 'Password':'admin' }", //Pass the parameter names and values
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
error: function (jqXHR, textStatus, errorThrown) { alert("Error- Status: " + textStatus + " jqXHR Status: " + jqXHR.status + " jqXHR Response Text:" + jqXHR.responseText) },
success: function () { alert('success'); window.location.href = "Index.aspx"; },
complete: function () { alert('complete'); }
});
});
});
I have an ajax function that works on Android, iPhone, Blackberry torch and webkit browsers. Im trying to test this on various version 5 and 6 blackberry simulators but the error handler always gets called.
eg response in message boxes is: Error, Complete.
The error returned from the function is:
'Error- Status: error jqXHR Status: 0 ResponseText:'
Whereas all other devices is: Success Complete.
Do I have to do something special for blackberry?
$(document).ready(function () {
//Login form Login link click
$("#login a.login").click(function () {
//Call the approve method on the code behind
$.ajax({
type: "POST",
url: "Login.aspx/LoginUser",
data: "{'Username':'admin', 'Password':'admin' }", //Pass the parameter names and values
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
error: function (jqXHR, textStatus, errorThrown) { alert("Error- Status: " + textStatus + " jqXHR Status: " + jqXHR.status + " jqXHR Response Text:" + jqXHR.responseText) },
success: function () { alert('success'); window.location.href = "Index.aspx"; },
complete: function () { alert('complete'); }
});
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从未深究过这个问题,唯一的解决方案是不要对版本 4 和 6 BB 使用 ajax
Never got to the bottom of this, only solution is to not use ajax for version 4 and 6 BB's
如果这是从您的代码复制并粘贴的内容,请尝试将“ssuccess”更改为“success”,看看是否可以纠正它。
If this is a copy and paste from your code, try changing "ssuccess" to "success" and see if that corrects it.
尝试将您的网址添加到白名单中
或
try adding your url in the whitelist
or