Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery AJAX timeout undefined

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) { } 
});
like image 277
Shamim Hafiz - MSFT Avatar asked Aug 03 '10 08:08

Shamim Hafiz - MSFT


1 Answers

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

    } 
});
like image 147
Darin Dimitrov Avatar answered Sep 19 '22 17:09

Darin Dimitrov