php - Why does AJAX not process login form? -


i writing simple login script in php form. can't work. there wrong ajax. when click submit button doesn't anything.

this login html form:

<form id="login_form">             <input type="text" class="input_field" name="username" id="username" value="gebruikersnaam" onclick="if(value=='gebruikersnaam'){ this.value='' }"/>             <input type="password" class="input_field" name="password" id="password"/>             <input type="submit" class="login_button" id="login_button" value="ga door"/>         </form> 

this ajax:

$(document).ready(function(){      $("#login_form").submit(function() {       $.ajax({            type: "post",            url: 'php/login_check.php',            data: $("#login_form").serialize(), // serializes form's elements.            succes: function(logincheck) {                 if (logincheck == 'true') {alert ("succes");}                 else {alert ("failed");}            }          });      return false; // avoid execute actual submit of form. }); }); 

this php:

<?php session_start();  include 'config.php';  $username = $_post['username']; $password = $_post['password'];  //check credentials $credentials_query = mysqli_query ($mysqli, "select * registered_users username='$username' , password='$password'");   $num_row = mysqli_num_rows($credentials_query); $row=mysqli_fetch_array($credentials_query); if( $num_row >= 1 ) {  echo 'true'; $_session['username_session']=$row['username']; } else { echo 'false'; } ?> 

i know basic stuff. still can't work. don't know i'm missing...?

you misspelt success succes.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -