jQuery AJAX timeout undefined
Asked Answered
J

1

8

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) { } 
});
Jackie answered 3/8, 2010 at 8:17 Comment(1)
Can you put a snipset of code here?Homosexual
F
9

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) { 

    } 
});
Fathomless answered 4/9, 2010 at 10:26 Comment(2)
I have tried it couple of times and I too am surprised that it wasn't working. It was happening at my office PC. Well let me try that now and see if things are working.Jackie
Looks to work here at my PC. I guess you are right, must have missed out something.Jackie

© 2022 - 2024 — McMap. All rights reserved.