带有jquery和php登录的google chrome已损坏

带有jquery和php登录的google chrome已损坏,php,jquery,google-chrome,Php,Jquery,Google Chrome,我在chrome中使用jquery有问题。 我有一个代码(登录代码),它在mozilla firefox中正常工作,但在chrome中输出为“1” 以下是所有代码-php部分 <?php session_start(); define('toDay',date('Y-m-d H:i')); define('lib','lib/'); include lib.'config.php'; include lib.'db.php'; if(isset($_POST['email'])){ if

我在chrome中使用jquery有问题。 我有一个代码(登录代码),它在mozilla firefox中正常工作,但在chrome中输出为“1”

以下是所有代码-php部分

<?php
session_start();
define('toDay',date('Y-m-d H:i'));
define('lib','lib/');
include lib.'config.php';
include lib.'db.php';

if(isset($_POST['email'])){
if(!empty($_POST['email']) && !empty($_POST['pass'])){
    $email = $_POST['email'];
    $pass = $_POST['pass'];
    $sql = $db->query("SELECT * FROM user WHERE email='$email' and       pass='$pass' limit 1");
    if( $u = $db->fetch($sql)){
        if($u['sath']=="modir"){
        $_SESSION['admin'] = true;
        $_SESSION['id']    = $u['id'];
        $_SESSION['time']  = time();
        $_SESSION['name']  = $u['name'];
        echo 1;}
        else{
        $_SESSION['user'] = true;
        $_SESSION['id']    = $u['id'];
        $_SESSION['time']  = time();
        $_SESSION['name']  = $u['name'];    
        echo 1;
        }

    }else{
    echo "رمز عبور یا ایمیل اشتباه می باشد .";  
    }
}
else {
    echo "لطفا جاهای خالی را پر کنید";
}
die();
}

?>
<!doctype html>

html部分和jquery

<html>
<head>
<meta charset="utf8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<!-- Apple devices fullscreen -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- Apple devices fullscreen -->
<meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />


<!-- Bootstrap -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Bootstrap responsive -->
<link rel="stylesheet" href="css/bootstrap-responsive.min.css">
<!-- Theme CSS -->
<link rel="stylesheet" href="css/style.css">
<!-- Color CSS -->
<link rel="stylesheet" href="css/themes.css">


<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<script src="js/migration.js"></script>
<!-- Bootstrap -->
<script src="js/bootstrap.min.js"></script>
<script src="js/eakroko.js"></script>

<!-- Favicon -->
<link rel="shortcut icon" href="img/favicon.ico" />
<!-- Apple devices Homescreen icon -->
<link rel="apple-touch-icon-precomposed" href="img/apple-touch-icon-precomposed.png" />
<script>

</script>

</head>

<body class='login'>
<div class="wrapper">
    <h1><a href="index.html"><img src="img/logo-big.png" alt="" class='retina-ready' width="59" height="49">تحلیلگران امین</a></h1>
    <div class="login-body">
        <h2>ورود کاربر</h2>
        <form id="login-form" method="post">
            <div class="email">
                <input type="text" name='uemail' id="uemail" placeholder="آدرس ایمیل" class='input-block-level'>
            </div>
            <div class="pw">
                <input type="password" name="upw" id="upw" placeholder="رمز عبور" class='input-block-level'>
            </div>
            <div class="submit">
                <input type="submit" value="ورود به پرتال مشتریان" class='btn btn-primary'>
            </div>
            <div class="_response">
                <span></span>
            </div>
        </form>

        <div class="forget">
            <a href="http://www.tgaco.ir/"><span>بازگشت به وبسایت تحلیلگران امین</span></a>
        </div>

    </div>
</div>
<script type="text/javascript">
 $(function() {


    $("#login-form").submit(function(){
    var uemail = $("#uemail").val();
    var upw = $("#upw").val();

        $.post('index.php',{email:uemail,pass:upw},function(data){
            if(data){

                    if(data == 1){
                        document.location.href = "admin/index.php"; 
                    }
                    else {
                    alert(data);
                    }

            }
        });
         return false;
    });

 });

</script>
</body>

</html>

ورود کاربر
$(函数(){
$(“#登录表单”).submit(函数(){
var uemail=$(“#uemail”).val();
var upw=$(“#upw”).val();
$.post('index.php',{email:uemail,pass:upw},函数(数据){
如果(数据){
如果(数据==1){
document.location.href=“admin/index.php”;
}
否则{
警报(数据);
}
}
});
返回false;
});
});

两次你都
回显1

 if( $u = $db->fetch($sql)){
    if($u['sath']=="modir"){
    $_SESSION['admin'] = true;
    $_SESSION['id']    = $u['id'];
    $_SESSION['time']  = time();
    $_SESSION['name']  = $u['name'];
    echo 1; //<=== HERE
  }
  else{
    $_SESSION['user'] = true;
    $_SESSION['id']    = $u['id'];
    $_SESSION['time']  = time();
    $_SESSION['name']  = $u['name'];    
    echo 1; //<=== HERE
  }
if($u=$db->fetch($sql)){
如果($u['sath']==“modir”){
$\u会话['admin']=true;
$_SESSION['id']=$u['id'];
$\u会话['time']=time();
$_SESSION['name']=$u['name'];

echo 1;//确认没有尾随空格或会破坏if条件的内容。例如,
console.log(“+data+”)
但是我更改了值,但chrome会提醒数字!!它应该重定向到页面,而不是提醒数字,而是在mozilla中重定向到页面。尝试
window.location=“admin/index.php”;
而不是
document.location.href=“admin/index.php”;