lukeocom lukeocom - 2 years ago 118
HTML Question

$.post() not working in Internet Explorer

My form sends perfectly well in Chrome and Firefox, with no errors displayed in firebug. However, in IE the form fails to send. I have narrowed it down to the

function, which just doesnt seem to be called in IE. The callback function works, the call to the php file does not.

I have created a fiddle here - deleted to prevent spam - Enter your own email address in the supplied field. Submitting the form will send a confirmation email to you. This fiddle works in Chrome and Firefox, but not IE.

I have read questions with similar issues, but none solve mine.

In short, why does the
function not work in IE?

The line in my .js:

var formData = $('#promo-form').serialize();
$.post('', formData).always(formSent);

Answer Source

If you are using the always utility, the callback will trigger irrespective of whether your ajax request was success or error. See the docs.

Form your post request target, your ajax call appears to be a cross domain call. So check in the chrome-inspctor or firbug console for more info. $.ajax has crossdomain settings which will get you going on Firefox and chrome but it will still fail on IE browsers where XMLHttpRequest objects are not supported.

So just because the callback you given on the always part is triggered, you cannot confirm that the ajax request was success.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download