Guest User

Untitled

a guest
Aug 25th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. Redirecting to a new page based on an AJAX call
  2. $.post("chklogin.php", { username: username, password: password }, function(data) {
  3. $('#msg').html(data);
  4. });
  5.  
  6. if(mysql_num_rows($result)==0) {
  7. $msg="<h3>Enter valid Username and Password.</h3>";
  8. echo $msg;
  9. } else {
  10. $row=mysql_fetch_assoc($result);
  11. $_SESSION["userid"]=$row["pgmail"];
  12. header("location:user.php");
  13. }
  14.  
  15. echo 'SUCCESS';
  16.  
  17. $.post("chklogin.php", { username: username, password: password }, function(data) {
  18. if(data=='SUCCESS'){
  19. window.location.href = "user.php";
  20. }else{
  21. $('#msg').html(data);
  22. }
  23. });
Add Comment
Please, Sign In to add comment