Submitting the following $.ajax, which is indeed executing but fails silently without any error. IE9 dev tools don’t spring an error and fiddler shows no traffic.
I can confirm the code does indeed execute since the “processing” bit does appear on the screen. However the rest seems to just fail. I am not doing x-domain.
$('.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>");
}
}
});
Using jQ 1.7.2. The code executes fine in Google Chrome but fails in IE7-9 and FF. Is statusCode not supported in older browsers?
Or should I just switch to SuperAgent for code response support? http://visionmedia.github.com/superagent/
Well it’s not a fix for jQuery but it is a fix for the AJAX call.
I just switched to SuperAgent and got the same thing working: