[jQuery] Re: Ajax error handling & textStatus

2009-12-29 Thread anatoly techtonik
What about $.load() callback? Seems like its called in all possible cases. The only disadvantage is error checking - is there any helper in jQuery to check textStatus for error? This one is not particularly beautiful. if (textStatus == 'error' || textStatus == 'timeout' || textStatus == 'parsererr

[jQuery] Re: Ajax error handling & textStatus

2009-12-09 Thread T.J. Simmons
No problem, glad to help. -T.J. On Dec 9, 1:12 pm, Cameron van den Bergh wrote: > Thank you for this information, indeed, i was using $.get. > > On 9 déc, 18:13, "T.J. Simmons" wrote: > > > > > Are you using $.ajax or one of the other AJAX functions? $.get and the > > rest only execute a callba

[jQuery] Re: Ajax error handling & textStatus

2009-12-09 Thread Cameron van den Bergh
Thank you for this information, indeed, i was using $.get. On 9 déc, 18:13, "T.J. Simmons" wrote: > Are you using $.ajax or one of the other AJAX functions? $.get and the > rest only execute a callback upon success; you'll need to use $.ajax > if you want a callback for an error. > > http://docs.

[jQuery] Re: Ajax error handling & textStatus

2009-12-09 Thread T.J. Simmons
Are you using $.ajax or one of the other AJAX functions? $.get and the rest only execute a callback upon success; you'll need to use $.ajax if you want a callback for an error. http://docs.jquery.com/Ajax/jQuery.get#urldatacallbacktype has some more information on that. -T.J. On Dec 9, 6:30 am,

[jQuery] Re: ajax error handling

2009-06-14 Thread Peter Marino
Hi, I'll just followup on my own statement.. I found the solution I was looking for. when calling $.ajax it has an event called error you can act on. error: function( XMLHttpRequest, textStatus, errorThrown ) the XMLHttpRequest has a method called responseText which is the actually text that the

[jQuery] Re: ajax error handling

2009-06-14 Thread MorningZ
I also deal with JSON almost exclusively (albiet in .NET, but getting the server side error would be the same) since $.getJSON doesn't handle error events, I wrote this simple wrapper around the $.ajax function GetAjax = function(url, params, success, error) { var CallParams = {}; CallPa

[jQuery] Re: ajax error handling troubles

2008-12-16 Thread Mike Alsup
> jQuery.ajax({ >         type: 'GET', >         url: "http://picasaweb.google.com/data/feed/base/user/ > picasa_non_esistent_user?kind=album&alt=json", >         dataType: 'jsonp', >         error: function (xhr, ajaxOptions, thrownError) { >             alert("error triggered"); >             if

[jQuery] Re: ajax error handling troubles

2008-12-16 Thread Luca Barbato
On Dec 15, 3:06 am, MareceK wrote: > Solution: > > error: function (xhr, ajaxOptions, thrownError) { > if(xhr.status == 404) { > // 404 error > } jQuery.ajax({ type: 'GET', url: "http://picasaweb.google.com/data/feed/base/user/ picasa_non_esistent_user?kind=album&alt=jso

[jQuery] Re: ajax error handling troubles

2008-12-14 Thread MareceK
Solution: error: function (xhr, ajaxOptions, thrownError) { if(xhr.status == 404) { // 404 error } else if(xhr.status == 403) { // 403 error } else { // default error } } On 17. Nov, 03:12 h., Mike Alsup wrote: > > errorThrown is for JavaScript errors (think try/catch).

[jQuery] Re: ajax error handling troubles

2008-11-16 Thread Mike Alsup
> errorThrown is for JavaScript errors (think try/catch).  40X responses > are not "thrown", they are just errors returned from the server and > you can get details from the xhr (ie: xhr.statusText). To elaborate slightly, the server could return an XML document with a 200 status code. But if th

[jQuery] Re: ajax error handling troubles

2008-11-16 Thread Mike Alsup
>                 $.ajax({ >                         async: true, >                         url: testingURL, >                         success: function () { >                                 location.reload(); >                         }, >                         error: function (XMLHttpRequest,

[jQuery] Re: ajax error handling troubles

2008-11-16 Thread Karl Rudd
The documentation for the ajax error function has this note in the example: // typically only one of textStatus or errorThrown // will have info ( http://docs.jquery.com/Ajax/jQuery.ajax#toptions ) Perhaps check the textStatus as well as the errorThrown? Karl Rudd On Mon, Nov 17, 2008 at