Simple PHP / MYSQL / jQUERY Login Script

In this tuto, we will let to know about Ajax login form using jQuey and PHP,
for this login form we need 3 files and they will be :
  1. index.php :
  2.  <!DOCTYPE html>  
     <html>  
      <link rel="stylesheet" href="css/style.css" media="screen" type="text/css" />  
      <script src=" https://code.jquery.com/jquery-2.1.4.min.js"></script>  
     <script src="js/app.js"></script>  
     <head>  
          <meta charset="utf-8">  
          <title>Tuto4free Login</title>  
     </head>  
     <body>  
       <div id="login-form">  
         <h3>Tuto4free</h3>  
         <fieldset>  
           <form action="login.php">  
             <input type="email" id="Email" required   placeholder="Email">   
             <input type="password" id="password" required   placeholder="Password">  
             <input type="submit" id="Log_btn" value="Login">  
             <footer>  
                <div id="err"></div>  
               <p><span class="info">?</span><a href="http://www.tuto4free.com">Lost my password</a></p>  
             </footer>  
           </form>  
         </fieldset>  
       </div>   
     </body>  
     </html>  
     </body>  
     </html>  
    
  3. login.php :
  4.  <?php   
          $pdo = new PDO('mysql:host=localhost;dbname=login', 'root','');  
          $SQL="SELECT * FROM `user` where email=? and Password=? ";  
          $req = $pdo->prepare($SQL);  
          $req->execute(array($_POST['username'],md5($_POST['password'])));  
          $res=$req->fetchAll();       
          if(count($res)==1)  
          {  
               echo "true";  
          }  
          else  
          {  
               echo "false";  
          }  
    
  5. app.js : 
  6.  $(document).ready(function(){  
       $("#Log_btn").click(function(){  
         username=$("#Email").val();  
         password=$("#password").val();  
          $.ajax({  
           type: "POST",  
           url: "login.php",  
           data: "username="+username+"&password="+password,  
           success: function(html){  
            if(html=='true')  
            {  
             $("#login-form").fadeOut();  
            }  
            else  
            {  
               $("#err").html("Wrong username or password");  
            }  
           },  
           beforeSend:function()  
           {  
              $("#err").html("Loading...")  
           }  
         });  
          return false;  
       });  
     });