Form won't submit after being loaded with jQuery .load()
I am loading a form into a div using jQuery's .load() and the form is useless once loaded.
My ultimate goal is to have a login form that fades out once submitted and a secure search bar appears right in its place:
$(function()
{
$("#login_form").submit(function()
{
$("#msgbox").removeClass().addClass('messagebox').text('Validating....').fadeIn(1000);
$.post("../../../utilities/ajax_login.php",{ username:$('#username').val(),password:$('#password').val(),rand:Math.random() } ,function(data)
{
if(data=='yes')
{
$("#msgbox").fadeTo(200,0.1,function()
{
$(this).html('Logging in.....').addClass('messageboxok').fadeTo(900,1,
function() {
$('#wp_login').fadeO开发者_Go百科ut(250, function() {
$('#instantModule').load('../../../utilities/instantV.php');
return false;
});
});
});
}
else
{
$("#msgbox").fadeTo(200,0.1,function()
{
$(this).html('Your login detail sucks...').addClass('messageboxerror').fadeTo(900,1);
});
}
});
return false; //not to post the form physically
});
$("#password").blur(function()
{
});
});
精彩评论