スプリング コントローラ:
response.sendError(500, ErrorMessage.DataBaseInsertFailed);
私の.jspページ
complete: function(e, xhr, settings){
var errorMessage = $.parseJSON(e.responseText);
alert(errorMessage);
}
e.status を実行すると、500 が返されます
e.resonseText を実行すると、テキスト全体が表示されますが、カスタム メッセージ 'Database failure due to ...' を表示したいのですが、アラート ステートメントが起動しません。私がalert(xhr)
それをしても、どちらも発火しません。
このドキュメントを見て、ドキュメントと一致するように署名を変更しました
complete
Type: Function( jqXHR jqXHR, String textStatus )
A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.