问题描述
我在尝试例如jQuery的例子,让我吃惊,我有一个AJAX调用提的是超时错误状态没有定义。当我删除timeout属性,它工作得很好。我下载的jQuery几天就回来,所以我pretty的确保它不是一个版本的问题。
我试图与Firefox(3.6.8),而不是其他任何浏览器。
为什么会出现这种情况?
修改:code段的意见提出的问题
$。阿贾克斯({
键入:GET,
数据类型:JSON,
网址:PHPServiceProxy,
超时:5000,
成功:函数(回复){} //注意:提供的原装code段在这里缺少一个逗号。
错误:函数(XHR,textStatus,errorThrown){}
});
在暂停
属性已经present jQuery的很长一段时间,所以我不认为你的问题是涉及到它。也许你有你的code语法错误。这应该工作:
$。阿贾克斯({
键入:GET,
数据类型:JSON,
网址:PHPServiceProxy,
超时:5000,
成功:函数(回复){
},
错误:函数(XHR,textStatus,errorThrown){
}
});
I was trying out example jQuery examples and to my surprise, I got an error state for an AJAX call mentioning that timeout isn't defined. When I removed timeout attribute, it worked fine.I downloaded jQuery few days back, so I am pretty sure it's not a version problem.
I was trying with Firefox(3.6.8) and not any other browser.
Why would this occur?
Edit: Code snippet moved from the comments to the question
$.ajax({
type: "GET",
dataType: 'json',
url: PHPServiceProxy,
timeout: 5000,
success: function(reply) { } // note: original code snippet provided was missing a comma here.
error: function (xhr, textStatus, errorThrown) { }
});
The timeout
property has been present in jQuery for a long time so I don't think that your problem is related to it. Maybe you have a syntax error in your code. This should work:
$.ajax({
type: 'GET',
dataType: 'json',
url: PHPServiceProxy,
timeout: 5000,
success: function(reply) {
},
error: function (xhr, textStatus, errorThrown) {
}
});
这篇关于jQuery的AJAX超时不确定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!