"timeout" is actually how long the request will wait to complete before it sends back a timeout error. You actually want setTimeout, like so. This will wait five seconds before doing the ajax request.

var t = setTimeout( function() {
              $.ajax({
                  type: "GET",
                    url: "myurl.com",
                  beforeSend: function() {
                      $("#adminToolsListingA .scroll").html("");
                     $("#adminToolsListingA .ajaxLoading").show();
                 },
                 success: function(html) {
                      $("#adminToolsListingA .ajaxLoading").hide();
                      $("#adminEditListingA .scroll").html(html);
                   }
               });
           }, 5000 );

-- Josh


----- Original Message ----- From: "hubbs" <[EMAIL PROTECTED]>
To: "jQuery (English)" <jquery-en@googlegroups.com>
Sent: Wednesday, August 20, 2008 11:25 AM
Subject: [jQuery] $.ajax() timeout



I seem to not be understanding how the ajax timeout works, because it
does not seem to work how I thought.

I was hope it would delay the ajax request, for the number of
miliseconds that is specified, but that does not seem to be working.
Is the timeout used for something different?  Or is there a different
way to delay an ajax request for a few seconds?

Using:

               $.ajax({
                   type: "GET",
    timeout: 5000,
                   url: "myurl.com",
                   beforeSend: function() {
                       $("#adminToolsListingA .scroll").html("");
                       $("#adminToolsListingA .ajaxLoading").show();
                   },
                   success: function(html) {
                       $("#adminToolsListingA .ajaxLoading").hide();
                       $("#adminEditListingA .scroll").html(html);
                   }
               });


Reply via email to