Provide only second parameter in javascript function
Specification for jQuery function ajax.error
:
error(XMLHttpRequest, textStatus, errorThrown)Function
I'm trying to catch the error and display textStatus
, but I can't figure out how to specify only textStatus
without specifying the variable name for XMLHttpRequest
and errorThrown
. Currently my code looks like this:
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: hbAddressValidation.webServiceUrl,
data: this.jsonRequest,
dataType: "json",
timeout: 5,
success: function (msgd) {
//...
},
error: function (a,textStatus,b) {
$("#txtAjaxError").val("There was an error in the AJAX call: "
+ textStatus);
}
});
In my code, you can see that I am putting variables a
and b
as placeholders for the first and last variables in the function error
. I know that in my success function I only provide one parameter and it works fine, but in this case it data
is the first parameter. In the case error
, textStatus
- the second parameter, but the only one I want to specify. Is it possible?
a source to share