Add responseJSON attribute to JQueryXHR

This commit is contained in:
noxhj
2014-06-11 13:01:26 +02:00
parent d84b415d60
commit 7643a269b2
2 changed files with 8 additions and 1 deletions
+3
View File
@@ -86,6 +86,9 @@ function test_ajax() {
success: function (data) {
$('.result').html(data);
alert('Load was performed.');
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Load ailed. responseJSON=' + jqXHR.responseJSON);
}
});
var _super = jQuery.ajaxSettings.xhr;
+5 -1
View File
@@ -80,7 +80,7 @@ interface JQueryAjaxSettings {
/**
* A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event.
*/
error? (jqXHR: JQueryXHR, textStatus: string, errorThrow: string): any;
error? (jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any;
/**
* Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events.
*/
@@ -168,6 +168,10 @@ interface JQueryXHR extends XMLHttpRequest, JQueryPromise<any> {
*/
overrideMimeType(mimeType: string): any;
abort(statusText?: string): void;
/**
* Property containing the parsed response if the response Content-Type is json
*/
responseJSON: any;
}
/**