javascript - Validations in Popup for form -


am working on login form in popup.. when form submitted returning validations , displaying errors want compare database in pop , display error message if login , password not matched had tried ajax email , password compared db..

js:

function login_validation(){      //worked validations empty string , email filter...they working fine displaying errors                                          $(document).ready(function(){         $("#upwd").on("focusout",function(){             var uemail = $("#uemail").val();             var upwd = $("#upwd").val();              $.ajax({                 type: "post",                 url: "checkl_login.php",                 data: 'uemail='+uemail+'&upwd='+upwd,                 success: function(msg){                 $('#status').html(msg);                     return false;                    }              });         });      }); } 

html:

<form name="f" method="post"  action='' onsubmit="return login_validation()">  <p><input type="text"  placeholder="email"  name="uemail"  id="uemail"  > </p><span id="uemailerror"></span>   <p><input type="password"  placeholder="password"  name="upwd"  id="upwd" ><span id="upassworderror"></span><span id="status"></span>  <!--submit button.. --> 

php, checkl_login.php:

ob_start();  session_start();  include('dbconnect.php');   include('gettime_diff.php');    mysql_select_db("hccommunity") or die(mysql_error());   if($_post['uemail'] && $_post['upwd']){      $loginemail = mysql_escape_string($_post['uemail']);        $loginpwd = mysql_escape_string($_post['upwd']);       $search = mysql_query("select * user email='".$loginemail."' , password='". mysql_escape_string(md5($loginpwd)) ."'") or die(mysql_error());         $match  = mysql_num_rows($search);        if($match > 0){           echo "ok";     }      else{         echo "error";     } } 

the form not displaying "error" or "ok" message....

replace/remove login_validation() function following code.

$(document).ready(function(){     $("form").on("submit",function(e){          var uemail = $("#uemail").val();         var upwd = $("#upwd").val();         e.preventdefault();         $.ajax({             type: "post",             url: "checkl_login.php",             data: 'uemail='+uemail+'&upwd='+upwd,             success: function(msg){             $('#status').html(msg);                 return false;                }          });     });  }); 

and replace form tag this

<form name="f" method="post" action=''>


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -