Hi there.

I'm using the Form Plugin (http://www.malsup.com/jquery/form/) to use
Ajax on my forms but I'm having a little problem with it.

I have this HTML form:
<form id="loginform" action="{Admin:BaseURI}/index.php" method="post">
        <div>
                <input name="internal" type="hidden" value="login" />
                <strong>Username:</strong><br />
                <input name="login_username" type="text" size="25" /><br />
                <br />
                <strong>Password:</strong><br />
                <input name="login_password" type="password" size="25" /><br />
                <br />
        </div>
        <div class="align-center">
                <input type="submit" value="Log In" />
        </div>
</form>

And the way I'm upgrading this form to use Ajax is this:
$('#loginform').ajaxForm({ success: ajaxResponse });

Another thing important to my problem (I think) are the last lines of
the PHP code to be executed when the submitted login details are
correct:
header("Location: index.php?internal=start");
exit();

Now my problem. If the login details are incorrect (bad username and/
or password) the form works fine, either clicking the "Log In" button
or pressing the Return key. However, when the login details are
correct the form works fine when I click the "Log In" button. But,
when I press the Return key (with the login details correct) "nothing
happens". And why did I use double-quotes? Because something happens,
the login is performed, I mean, the PHP code is executed successfully
and the user is logged in, if you refresh the page, you will be logged
in and the login page will be gone. The thing is, if I login using the
"Log In" button I will be redirected to "index.php?internal=start" but
if I login using the Return key, I won't be redirected, I need to
refresh the page.

This makes no sense to me, why this is happening? If I don't use the
Form Plugin/Ajax, the login form works fine and I can login using the
"Log In" button or the Return key and I will be automatically
redirected.

Any hints? I need this fixed ASAP!

Reply via email to