Root
Root

Reputation: 2349

jQuery AJAX .post doesn't work in IE

I have a problem using AJAX .post in Internet Explorer. In all other browsers, this works fine (Firefox, Safari, Chrome, Opera). On the login page of my website, using .post doesn't work.

Below is the JavaScript:

$(document).ready(function() {
    $("#even tr:even").addClass("even");
    $('#login_loader').hide();
    $("#login_form_submit").click(function() {
        $('#login_form_submit').attr('disabled', true);
        $('#login_loader').fadeIn(200);
        $('#login_group').slideUp(500);
        $('#logout_hint').slideUp(500);
        $('#login_contact_form').slideUp(500);
        $.post("action/login.php?act=login", {
            username: $('#login_username').val(),
            password: $('#login_password').val(),
            captcha: $('#login_captcha').val()
        }, function(response) {

            setTimeout("finishAjax('login_group', '" + escape(response) + "')", 1000);
        });
        return false;
    });
});

function finishAjax(id, response) {
    $('#login_loader').slideUp(300);
    $('#login_contact_form').fadeIn(300);
    $('#' + id).html(unescape(response));
    $('#' + id).fadeIn(500);
    $('#login_form_submit').attr('disabled', false);
    $("#captchaImg").attr("src");
}​

Does anyone know what's the problem?

Thanks

Upvotes: 0

Views: 1102

Answers (2)

bottlenecked
bottlenecked

Reputation: 2157

IE is notorious for it's aggressive caching, have you ruled out this possibility?

If not, try to add the following line in your html

<!--[if IE]><script type="text/javascript">$.ajaxSetup({cache: false});</script><![endif]-->

Or you could set it on a per request basis if it turns out that this was it after all

Upvotes: 2

user2428118
user2428118

Reputation: 8104

Are you testing this from a file or from a web server? If you're trying to do this from a file, I suggest you install a web server and try again.

Edit: what exactly doesn't work? When I submit the form, a POST request is being sent and there are no errors in the console.Debugging screenshot

What version of Internet Explorer are you using?

Upvotes: 0

Related Questions