开发者

jQuery AJAX timeout undefined

开发者 https://www.devze.com 2023-01-10 04:26 出处:网络
I was trying out example jQuery examples and to my surprise, I got an error state for an AJAX callmentioning that timeout isn\'t defined. When I开发者_JAVA技巧 removed timeout attribute, it worked fin

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开发者_JAVA技巧 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) { 

    } 
});
0

精彩评论

暂无评论...
验证码 换一张
取 消