单击提交按钮时,Html5登录按钮无响应

时间:2015-02-05 22:29:14

标签: javascript php jquery ajax html5

单击提交按钮时,

Html5登录按钮无响应。下面的内容是记住我的功能,但点击时按钮什么都不做。任何帮助将不胜感激,以下是目前的努力。感谢

    <script src="jquery-1.9.1.js"></script>


<script>
            $(function() {

                if (localStorage.chkbx && localStorage.chkbx != '') {
                    $('#remember_me').attr('checked', 'checked');
                    $('#username').val(localStorage.usrname);
                    $('#pass').val(localStorage.pass);
                } else {
                    $('#remember_me').removeAttr('checked');
                    $('#username').val('');
                    $('#pass').val('');
                }

                $('#remember_me').click(function() {

                    if ($('#remember_me').is(':checked')) {
                        // save username and password
                        localStorage.usrname = $('#username').val();
                        localStorage.pass = $('#pass').val();
                        localStorage.chkbx = $('#remember_me').val();
                    } else {
                        localStorage.usrname = '';
                        localStorage.pass = '';
                        localStorage.chkbx = '';



var userdata= "username="+username+"&pass="+pass+"&remember_me="+remember_me;


            $("#loader").show();
            $("#loader").fadeIn(400).html('<img src="loader.gif" align="absmiddle">&nbsp;<span class="loading">Checking your details please be patient</span>');

            $.ajax({

                type:"post",
                data:userdata,
                url:"signin.php",
                cache:false,
                success:function(msg){

                    $("#loader").hide();
                    $('.error').fadeIn(200).html(msg);

                }

            });


                    }
                });
            });

        </script>

        <div class="container">
            <form class="form-signin">
                <h2 class="form-signin-heading">Please sign in</h2>
                <input type="text" class="input-block-level" placeholder="username" id='username'>
                <input type="password" class="input-block-level" placeholder="Password" id="pass">
                <label class="checkbox">
                    <input type="checkbox" value="remember-me" id="remember_me"> Remember me
                </label>
                <button class="btn btn-large btn-primary" type="submit">Sign in</button>
            </form>
        </div> 







<?php


require("db_pdo.php");


$username=strip_tags($_POST["username"]);
$pass=strip_tags($_POST["pass"]);
$remember_me=strip_tags($_POST["remember_me"]);




$statement = $db->prepare('
        SELECT * FROM members
        WHERE username = :username
        AND password = :password AND remember_me = :remember_me

    ');






    $statement->execute(array(
':usernameu' => $username,
':password' => $pass,
':remember_me' => 'remember_me'));




    if ($row = $statement->fetch()) {

$user=$pid=htmlentities($row['fullname'], ENT_QUOTES, "UTF-8");

echo "Welcome Mr/Mrs <b>".$user."</b> <font color=pink>you are signed in successfully. <br>Redirecting in 2 seconds</font> <img src=loader.gif>";


echo '<script>
window.setTimeout(function() {
    window.location.href = "welcome.html";
}, 2000);
</script>';

}else{

echo '<font color=red size=2><b>Either of your details is wrong. You are trying to use login accounts that belongs to another
person</b></font>';

}





?>

0 个答案:

没有答案