I'm using jQuery's .load()
method to retrieve some data when a user clicks on a button.
After the load successfully finishes, I show the result in a <div>
.
The problem is, sometimes an error occurs in load()
while retrieving the data.
How can I catch an error in load()
?
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.