Hi,

I had a problem with an AJAX post call.

The problem was, some times it returned data, and some times it
didn't. It had nothing to do with domain server crossing, nor server
errors,
as it some times worked and some times it doesn't.

What I found was, it worked most of the times in a high bandwith
connection (enterprise bandwith). But when I tried it with low band
connections, most of
the times it did not work. The function did not receive any data from
the server.
I checked the server when it happened, and the server always did the
task and returned data. It was as if the data got lost in the
response.

Then, I configured AJAX calls using AJAXsetup to check what was the
problem. Just like this:

$.ajaxSetup({
               error:function(request, error){

                       if(request.status == 0){
                               alert('You are offline!!\n Please Check
Your Network.');
                       }
                       else if(request.status == 404){
                               alert('Requested URL not found.');
                       }
                       else if(request.status == 500){
                               alert('Internal Server Error.');
                       }
                       else if(error == 'parsererror'){
                               alert('Error.\nParsing Request
failed.');
                       }
                       else if(error == 'timeout'){
                               alert('Request Time out.');
                       }
                       else{
                               alert('Unknow Error.
\n'+request.responseText);
                       }
               }
       });

I found I was getting timeouts from post ajax calls. So I have setted
the timeout property in AJAXsetup with a timeout value.

Now my question is, which is the default timeout jQuery AJAX calls are
using if you don't specify any timeout?


Thanks ins advanced.

Reply via email to