title: How can i fix this type of error: "Uncaught ReferenceError: check_email is not defined onblur"
body: <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;Amateur&lt;/title&gt;
      &lt;link rel="stylesheet" href="css/reset.css" type="text/css"&gt;
      &lt;script src="http://code.jquery.com/jquery-1.8.0.js"&gt;
          function check_email()
          {
              var email=$("#txtEmail").val();
              $.ajax(
              {
                  type:"POST";
                  url:"index.php";
                  data:"email="+email,
                  success:function(msg)
                  {
                      $("#chkEmail").html(msg);
                  }
              });
  
              return false;
          }
      &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;form method="post"&gt;
      &lt;label for="txtEmail"&gt;E-mail:&lt;/label&gt;
          &lt;input id="txtEmail" name="email" type="email" onblur="return check_email()"&gt;
      &lt;label id="chkEmail" for="txtEmail"&gt;&lt;/label&gt;
      &lt;?php
  
      if(isset($_POST['email']))
      {
          $user='root';
  
          $pdo=new PDO('mysql:host=localhost;dbname=class;charset=utf8',$user);
  
          $email=$_POST['email'];
  
          $stmt=$pdo-&gt;prepare('SELECT email from tbl_users WHERE email=:email LIMIT 1');
          $stmt-&gt;execute(array(':email'=&gt;$email));
  
          if($stmt-&gt;rowCount()&gt;0)
          {
              echo 'E-mail already use.';
          }
          else
          {
              echo 'E-mail not use.';
          }
  
      }
  
      ?&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I am still a starter in PHP and JQuery I want to know how to fix this type of error? I check it from firebug. The flow is that after the user done typing the email it will check automatically from the database if it exist or not. And the expected output does not show in my page.</p>