Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. $.ajax({
  2. url: 'yourusernamecheckpage.php',
  3. type:'post',
  4. data:{'username':$('#yourusername').val()},
  5. beforeSend:function(){
  6. //do a loading msg..like checking..
  7.  
  8. },
  9. success:function(msg){
  10. if(msg == 'ok'){
  11. //username available
  12. }else{
  13. //username not available
  14. }
  15. },error:function(msg){
  16.  
  17. alert(msg);
  18. }
  19.  
  20.  
  21. });
  22.  
  23. //yourusernamecheckpage.php
  24. //you can get the username as $_POST['username']:
  25. //do your validation and
  26. echo 'ok';exit;
  27. //if available
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement