Edentity Web Systems
You solve creative. We crack code.
/Header/WhoWeAre.jpg
 

12/16/2009 Catching errors on the jQuery's load() function
Posted by Osvel Legon

When using the jQuery's load function there is a way to catch the errors. The callback is full of parameters from the request and the response:

$("body").load("/load.aspx", function (responseText, textStatus, XMLHttpRequest) {
    if (textStatus == "error") {
       alert('Error!');
       // XMLHttpRequest.responseText has the error info you want.
       alert(XMLHttpRequest.responseText);
    }
});

The XMLHttpRequest is a full XMLHttpRequest object.

Also you can register a general error handler for all the jQuery ajax calls:

$.ajaxError(function(event, request, settings) {
      alert("Oops!!");
});

 

« Back to Blog Main Page |

0 Comment(s)

Leave Comment

Name:
Comment:  
 
Edentity Web Systems Inc.
Suite 201
40 Spadina Ave.
Toronto ON
M5V 2H8
Tel:
416.591.2500
Fax:
416.352.5270

From Our Blog

03/17/2010
03/16/2010
What is Cloud Computing? Posted by Joel Varty
03/14/2010
Why Multitenancy Matters In The Cloud Posted by Michael Assad
Home | Who We Are | What We Do | Clients & Brands | Careers | Contact

Copyright © 2010 Edentity Web Systems Inc. Privacy Policy