diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 79dda3e54..62c237b47 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -6,7 +6,7 @@ function test_add() { $('li').add('p').css('background-color', 'red'); $('li').add(document.getElementsByTagName('p')[0]) - .css('background-color', 'red'); + .css('background-coailor', 'red'); $('li').add('

new paragraph

') .css('background-color', 'red'); $("div").css("border", "2px solid red") @@ -86,6 +86,9 @@ function test_ajax() { success: function (data) { $('.result').html(data); alert('Load was performed.'); + }, + error: function (jqXHR, textStatus, errorThrown) { + alert('Load failed. responseJSON=' + jqXHR.responseJSON); } }); var _super = jQuery.ajaxSettings.xhr; diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index d6a6a792e..6fff3fab6 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -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 { */ overrideMimeType(mimeType: string): any; abort(statusText?: string): void; + /** + * Property containing the parsed response if the response Content-Type is json + */ + responseJSON?: any; } /**