Advertisement
Guest User

Untitled

a guest
Apr 12th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. <?php
  2. ...
  3. ...
  4.  
  5. if ( $username && $password )
  6. {
  7. $data['response'] = 'valid';
  8. else
  9. {
  10. $data['response'] = 'invalid';
  11. }
  12.  
  13. echo json_encode($response);
  14.  
  15. $.ajax({
  16. type: 'POST',
  17. url: 'url',
  18. data: {username : username, password: password},
  19. success: function(response){
  20. if(response.response === valid){
  21. window.location.replace('admin-page');
  22. }else{
  23. //error
  24. }
  25. }
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement