The code I gave sets the global error handler using $.ajaxSetup() - best is to use that and set the error handler when you set the timeout.
If you only wish to set it for a single request though then you need to pass the 'error' parameter to $.ajax() instead. --rob On 6/15/07, joomlafreak <[EMAIL PROTECTED]> wrote:
Cool.. This is work, not tried yet but I am hopeful. I have one concern though. I have the above described situations at many places in my application http://feed.joomlaprodigy.com/ and all are prone to the situation I described in my post above. Is there a way I can do it globally. By the above means it seems I have to provide the element's id to do the slideUp and since it is a global function, how do I do the slideup only for the one which had failed response. If I write all of them in the function then even the one which had successful request will slideUp. Don't know if I could explain my question clearly. BTW thank you very much for the tip. I will try to play with it and post back if I get something working. On Jun 15, 8:59 am, "Rob Desbois" <[EMAIL PROTECTED]> wrote: > Does this catch a timeout condition? If so you could do the slideUp() from > there. > > $.ajaxSetup({ > > > error: function() { > > // ... > > } > > }); > > --rob > > On 6/15/07, joomlafreak <[EMAIL PROTECTED]> wrote: > > > > > > > Many times the ajax request gets timeout and the show/hide or slideup/ > > down function gets stalled. Even the next succcessful ajax call does > > not update the element. > > > I wonder how can I set up some global callback / local callback > > function so that those element which should have been updated are > > cleared up for next successful callback. > > > for example, lets say I have this code > > > function test(){ > > $("#loading").slideDown("slow"); > > $.get(url,function(result){ > > $("container").html(result); > > $("#loading").slideUp("slow"); > > } > > > Now as the function test is called it shows the loading div slidedown > > showing the message "loading...." > > and once the ajax request is successful, the same div slideup. > > > However, in case the ajax request timeout occurs, the div stays open > > and even if the next call to this function results in successful ajax > > request, this div stays open. Basically it likks the show. Everything > > is sorted out once you refresh the page. > > > How can I sort this practical question/problem? > > -- > Rob Desbois > Eml: [EMAIL PROTECTED] > Tel: 01452 760631 > Mob: 07946 705987 > "There's a whale there's a whale there's a whale fish" he cried, and the > whale was in full view. > ...Then ooh welcome. Ahhh. Ooh mug welcome.
-- Rob Desbois Eml: [EMAIL PROTECTED] Tel: 01452 760631 Mob: 07946 705987 "There's a whale there's a whale there's a whale fish" he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome.