5
對於Spring MVC控制器中的驗證錯誤,我將自定義標頭錯誤設置爲響應標題。我可以在Firefox 3.5中訪問該響應頭。但不是在IE 8中。 請告訴我,將自定義錯誤消息顯示給Jquery客戶端的正確方法。getResponseHeader在IE 8中返回null
var jqxhr=$.post("saveAcc.htm",{ data: data});
jqxhr.success(function() {
alert("Saved");
});
jqxhr.error(function(thrownError){
fnSetError(jqxhr.getResponseHeader('error'));
alert(jqxhr.getAllResponseHeaders()); //returns empty
//alert('responseText '+ thrownError.responseText);
alert(jqxhr.getResponseHeader('error')); //return null
oTable.fnReloadAjax();
});
我不知道這是否會有所幫助,但試試這個:http://forum.jquery.com/topic/jquery-ajax-ie8-problem,這一個關於IE8中jquery $ .ajax的bug報告,以及一些可能的修復。 – joao 2013-09-13 13:58:52