Advertisement
csojunior1996

Códigos doidera

Dec 20th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. //Código do meu input que vai o email
  2.  
  3. <div class="form-group">
  4. <label for="emailCadastro">E-mail</label>
  5. <div class="input-group">
  6. <div class="input-group-addon">@</div>
  7. <input id="emailCadastro" name="emailCadastro" type="email" placeholder="E-mail" class="form-control" data-error="Por favor, informe um e-mail correto." required>
  8. </div>
  9. <div class="help-block with-errors"></div>
  10. </div>
  11.  
  12. --------------------------------------------------------------------------------------------------------------------------
  13.  
  14. //Código do evento que uso pra mandar a requisição
  15.  
  16. $('#emailCadastro').blur(function(){
  17. var email = $('#emailCadastro').val();
  18. if(email != ''){
  19. $.ajax({
  20. url: '/ead/cadastro/verificaEmail',
  21. type: 'POST',
  22. data: email,
  23. async: false,
  24. success: function (data) {
  25. alert(data);
  26. if(data == '1'){
  27.  
  28. }else{
  29.  
  30. }
  31. },
  32. cache: false,
  33. contentType: false,
  34. processData: false
  35. });
  36. return false;
  37. }
  38. });
  39.  
  40. ---------------------------------------------------------------------------------------------------------------------------------
  41.  
  42. //Código da função em PHP que vai pegar o valor mandado na requisição
  43.  
  44. public function verificaEmail(){
  45. $email = $_POST['emailCadastro'];
  46. $aluno = new Alunos();
  47. $aluno->isExistEmail($email);
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement