2015-04-23 98 views
0

我在Jquery中創建了一個彈出登錄窗體。並且工作正常。但當點擊提交按鈕彈出隱藏和錯誤顯示消息,如wrong username and password顯示當我再次打開登錄彈出窗體。如果出現錯誤消息,我希望彈出窗體保持打開狀態。Jquery登錄彈出窗體關閉時提交點擊提交

$(function() { 
    // Calling Login Form 
    $("#login_form").click(function() { 
     $(".social_login").hide(); 
     $(".user_login").show(); 
     return false; 
    }); 

    // Calling Register Form 
    $("#register_form").click(function() { 
     $(".social_login").hide(); 
     $(".user_register").show(); 
     $(".header_title").text('Register'); 
     return false; 
    }); 

    // Going back to Social Forms 
    $(".back_btn").click(function() { 
     $(".user_login").hide(); 
     $(".user_register").hide(); 
     $(".social_login").show(); 
     $(".header_title").text('Login'); 
     return false; 
    }); 

}) 
+2

你需要向我們展示一些代碼 –

+0

可以顯示我們彈出模態DOM,並且您是否使用彈出窗口的任何插件? – Katrin

+0

我正在使用本教程http://www.andwecode.com/create-popup-login-and-signup-form/ –

回答

0
<script type="text/javascript"> 
    $(document).ready(function(){ 
      <?php if ($error == 'true'): ?> 
       $("#popup-login").modal('show');  
      <?php endif ?> 
    }); 
</script> 
在你的控制器

,經過身份驗證設置AA錯誤標記爲真,這樣如果發生錯誤模式將保持打開狀態,甚至頁面刷新