Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/436.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/242.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript JQuery函数没有运行_Javascript_Php_Jquery - Fatal编程技术网

Javascript JQuery函数没有运行

Javascript JQuery函数没有运行,javascript,php,jquery,Javascript,Php,Jquery,下面的程序包含在特定条件下显示的各种错误消息。这些条件是通过PHP代码找到的,之后,必要的JQuery脚本将在PHP中进行响应,以显示消息 首先,隐藏.warning类中的所有消息。然后,如果满足某个条件,将显示该类的特定ID。以下是相关代码 <?php require_once 'connection.php'; ?> <!-- To change this template, choose Tools | Templates and open the template in

下面的程序包含在特定条件下显示的各种错误消息。这些条件是通过PHP代码找到的,之后,必要的JQuery脚本将在PHP中进行响应,以显示消息

首先,隐藏.warning类中的所有消息。然后,如果满足某个条件,将显示该类的特定ID。以下是相关代码

<?php require_once 'connection.php'; ?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Create Account</title>
        <link rel="stylesheet" type="text/css" href="Styles2.css">
        <script src="JQuery.js"></script>
    </head>
    <body>

        <script>

    $(document).ready(function(){

 $('.warning').hide();

 });


    </script>

    <div class="unloggedheadingbar">

    </div>

    <br>

    <div class="createaccount">  

        <center><h1>Create Account</h1></center>

    <center><table>
        <form action="create_account.php" method="post">

         <tr><td><font class="createaccountfont">Email</font></td><td><input type="text" name="Email" placeholder="someone@somewhere.com" value="<?php if(isset($_POST['Create'])){ echo $_POST['Email']; } ?>" class="createaccounttext"></td></tr>
         <tr><td colspan="2"><br></td></tr>
         <tr><td><font class="createaccountfont">Password</font></td><td><input type="password" name="Password" class="createaccounttext"></td></tr>
         <tr><td colspan="2"><br></td></tr>
         <tr><td><font class="createaccountfont">Confirm Password&nbsp;&nbsp;</font></td><td><input type="password" name="ConfirmPassword" class="createaccounttext"></td></tr>

    </table></center>

        <br>

        <center><input type="submit" name="Create" value="Create Account" class="createButton" id="Create"></center>

        </form>

            <br>    

            <div class="warning" id="passwordMatchError">
                <center><font class="warningText">Your password confirmation must match with your original password!</font></center>
            </div>  

            <div class="warning" id="emailFormatError">
                <center><font class="warningText">Your email must match the someone@something.com format.</font></center>
            </div>

            <div class="warning" id="emailDuplicateError">
                <center><font class="warningText">An account under this email already exists.</font></center>
            </div>

        </div>

    <?php

    if(isset($_POST['Create'])){

        $email = $_POST['Email'];
        $password = md5($_POST['Password']);

        if(strpos($email, '@') !== TRUE){

            echo '<script>

                $(".warning").hide();

                $("#emailFormatError").show();

                  </script>';

        }elseif($_POST['Password'] != $_POST['ConfirmPassword']){

            echo '<script>

                $(".warning").hide();

                $("#passwordMatchError").show();

                  </script>';

        }else{

        $query = "SELECT * FROM user_table WHERE Email = '" . $email . "';";
        $result = mysqli_query($con, $query);

        if(mysqli_num_rows($result) == 0){

        $query = "INSERT INTO user_table VALUES ('" . $email . "', '" . $password . "');"; 
        mysqli_query($con, $query);

        }else{

           echo '<script>

                $(".warning").hide();

                $("#emailDuplicateError").show();

                  </script>';

        }

        }
    }

    ?>

</body>

创建帐户
$(文档).ready(函数(){
$('.warning').hide();
});

创建帐户
电子邮件jQuery操作应该放在
$(document.ready(function(){})中,即:

echo '<script>$( document ).ready( function () {
    $(".warning").hide();
    $("#emailFormatError").show();
} );</script>';
echo'$(文档).ready(函数(){
$(“.warning”).hide();
$(“#emailFormatError”).show();
} );';