title: Check User Validation in MySql with javascript
body: <p>i want check in my mysql database if the user enter the username and password correctly and then go in the home.html, i have some javascript code that detect when the user click the login button, but i can't understand how check in the database with javascript, i know how do that in php, but i can't understand how call the php from the javascript or do it directly in the js code, this is some code:</p>
  
  <p>the form in the html:</p>
  
  <pre><code>    &lt;div id="password"&gt;
          &lt;div class="input username"&gt;&lt;input type="text" placeholder="User name" /&gt;&lt;/div&gt;
          &lt;div class="input password"&gt;&lt;input type="password" placeholder="Password" /&gt;&lt;/div&gt;
          &lt;button&gt;Log in&lt;/button&gt;
          &lt;a href="#" class="back"&gt;Back&lt;/a&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>then in my Login.js file i have this:</p>
  
  <pre><code>function forgot() {
  //Se ho scritto la password allora fai l'animazione wobble, altrimenti vai in home.html
      if($("#password .input.password input").attr("value")!='') {
          $.notification( 
              {
                  title: "Wrong password",
                  content: "Just leave the password field empty to log in.",
                  icon: "!"
              }
          );
          $("#password").removeClass().addClass("animated wobble").delay(1000).queue(function(){ 
              $(this).removeClass();
              $(this).clearQueue();
          });
          $("#password .input.password input").attr("value", "").focus();
      } else {
          document.location.href = "home.html";
      }
  }
  </code></pre>
  
  <p>now for the login i detect only if the field are empty, but i want detect mysql database  how i can check it? because i want if the user enter wrong username and password span a $notification alert, anyone can help me?</p>