0
正在提交以下$ .ajax,它確實正在執行,但以靜默方式失敗,沒有任何錯誤。 IE9開發工具不會彈出錯誤,提琴手不會顯示流量。
由於「處理」位確實出現在屏幕上,我可以確認代碼確實執行了。但其餘的似乎只是失敗。我是而不是做x域。
$('.signupMsg').html("<img src='/assets/img/load-black.gif' /> Processing...");
var data = $('#emailForm').serialize();
$.ajax({
url: 'https://example.com/proxy/emaillist',
type: 'POST',
data: data,
statusCode: {
200: function(msg) {
$('.signupBlock').html(" <br><strong>Thank you!</strong><br>You will be hearing from us soon.");
$('#emailForm').remove();
},
500: function(msg) {
$('.signupBlock').html(" <br><strong>Something went wrong.</strong><br>Sorry about that, please <a href='/'>refresh</a> and try again.");
$('#emailForm').remove();
},
404: function(msg) {
$('.signupBlock').html(" <br><strong>Something went wrong.</strong><br>Sorry about that, please <a href='/'>refresh</a> and try again.");
$('#emailForm').remove();
},
503: function(msg) {
$('.signupBlock').html(" <br><strong>Server temporarily down.</strong><br>Sorry about that, please <a href='/'>refresh</a> and try again.");
$('#emailForm').remove();
},
400: function(msg) {
$('.signupMsg').html("<span style='color:red'>Email validation failed, please try again.</span>");
}
}
});
使用jQ 1.7.2。該代碼在谷歌瀏覽器中運行良好,但在IE7-9和FF中失敗。舊版瀏覽器是否支持statusCode?
或者我應該切換到SuperAgent代碼響應支持? http://visionmedia.github.com/superagent/