加载jQuery后,表单不会提交.load()

时间:2011-06-24 05:19:07

标签: jquery forms load

我正在使用jQuery的.load()将表单加载到div中,并且一旦加载,该表单就没用了。

我的最终目标是让一个登录表单在提交后淡出,并在其位置出现一个安全的搜索栏:

$(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').fadeOut(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()
    {
    });
});

0 个答案:

没有答案