在PHP代码之前执行jQuery代码和动画

Hi i have been adding some animations to my website like on the login page etc

however I first found that the Animation executes but not the PHP code and when i get the PHP code to execute then the Animation doesnt work... PHP code is more important however it seems even if i use the form.submit() function in jquery the PHP code never triggers. i know this as i tried alternate methods and it works without the jQuery.

i am using 1.9.0 and here is the jQuery code

jQuery('#loginform button').click(function()
        {
            if(!jQuery.browser.msie) 
            {
                if(jQuery('#username').val() == '' || jQuery('#password').val() == '') 
                {
                    if(jQuery('#username').val() == '') jQuery('#username').addClass('error'); else jQuery('#username').removeClass('error');
                    if(jQuery('#password').val() == '') jQuery('#password').addClass('error'); else jQuery('#password').removeClass('error');
                    jQuery('.loginwrap').addClass('animate0 wobble').bind(anievent,function()
                    {
                        jQuery(this).removeClass('animate0 wobble');
                    });
                } 
                else 
                {
                    jQuery('.loginwrapper').addClass('animate0 fadeOut').bind(anievent,function()
                    {
                        $.post(username, {username});
                        $.post(password, {password});
                        jQuery('#loginform').submit();
                    });
                }
                return false;
            }
        });

as you can see, originally i got the code to post from the jquery however the animation does not run no matter what i tried.

can anyone tell me why... or what way am i supposed to make it that the animation happens then the PHP???

查看全部
dongmaopan5738
dongmaopan5738
2013/03/18 19:54
  • php
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复