I am utilising the callback function of jQuery's .load method to run certain code if the textStatus
parameter of the .load
method is equal to a certain string.
e.g. I have
jQuery("#myContainer").load('/seperate-file-with-content.asp', function(responseText, textStatus, xhr){
if (textStatus === "error" || responseText.length <= 0) {
//file failed to load i.e. textStatus == error
//or file loaded but has no content
} else {
//file loaded successfully i.e. textStatus == success
}
});
But i'm worried that the else
part of the if
statement may catch other non expected textStatus
values that aren't equal to success
.
Are there any other possible values to textStatus, other than error
and success
?
EDIT/UPDATE: As I now believe that .load
is based on .ajax
, the answers in the following question may be of use for anyone else with a similar question:- In jQuery's ajax success callback, will textStatus ever not be "success"?
load()
is based on $.ajax(), and the documentation for this method lists the possible statuses as:
abort
error
notmodified
parsererror
success
timeout
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With