weixin_33709364 2014-07-06 13:31 采纳率: 0%
浏览 8

模式登录表单

I have a webpage, where I want the ability to log in and see some user stuff. To log in, you have to click on a link, and then a jQuery modal window, is appearing. My question is now, how to I implement the login form, so the user actually can log in?

Right now, it is only input fields, without any php, since the modal is JavaScript generated.

Should I add the login-PHP on every single pages on my site, or should I add an iframe in the modal, linking to the login.php file, or should I use AJAX to send the username and password to an external site, or something else?

Some one who please can help me? :)

  • 写回答

1条回答 默认 最新

  • weixin_33701251 2014-07-06 13:46
    关注

    Use ajax, send your login info to the sever and get a code for confirmation, if the confirmation code is received, then the close modal and reload the page, here is a code snippet i used for my project once, it worked fine modify it to suite style

    <script type="text/javascript" language="JavaScript">
    
        function action(num) {
            $.ajax({
                cache: false,
                type: 'POST',
                url: 'action_reciver.php',
                data: 'confirm=' + num
    
            });
        }
    </script>
    

    this code will send info the action_receiver.php using the post request method. Use the console to debug.

    评论

报告相同问题?