php - Jquery login popup form closed when clicking on submit -
i created popup login form in jquery. , working fine. when in clicked on submit button popup hides , error show message wrong username , password
displayed when open login popup form again. want popup form remain open if there error message.
$(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 social forms $(".back_btn").click(function () { $(".user_login").hide(); $(".user_register").hide(); $(".social_login").show(); $(".header_title").text('login'); return false; }); })
<script type="text/javascript"> $(document).ready(function(){ <?php if ($error == 'true'): ?> $("#popup-login").modal('show'); <?php endif ?> }); </script>
in controller, after authentication set a error flag true if error occur modal remain open page refresh