How to catch error in jQuery’s load() method

load() documentation.

Just a little background on how a load error happens…

$("body").load("/someotherpath/feedsx.pxhp", {limit: 25}, 
    function (responseText, textStatus, req) {
        if (textStatus == "error") {
          return "oh noes!!!!";
        }
});

Edit: Added a path other than the root path as requested by comments.

Leave a Comment