Guest User

Untitled

a guest
Mar 21st, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. $(function () {
  2. $('.error').hide();
  3. $(".form_submit").click(function () {
  4. $('.error').hide();
  5. var email = String($("input#email").val());
  6.  
  7. //init ajax
  8.  
  9. $.ajax({
  10. url: 'php/scripts/subscriber_exists.php',
  11. type: 'post',
  12. data: { email : email},
  13. error: function (xhr,error) {
  14. alert("xhr --> " + JSON.stringify(xhr) + " error --> " + JSON.stringify(error));
  15. console.log(xhr);
  16. console.log(error);
  17. },
  18. success: function (response) {
  19. var success = $.trim(String(response));
  20. if (success == 'false' ) {
  21. alert("Thank you so much!! --> [" + success + "]");
  22. } else
  23. alert("We understand your enthusiasm but you already are a subscriber! :D Thank you so much once again! [" + success + "]");
  24. }
  25. });
  26. //end ajax
  27. return false;
  28. });});
  29.  
  30. include_once '../class/mariaConnection.php';
  31. include_once '../class/subscriber.php';
  32.  
  33. $email = $_POST['email'];
  34. $maria = mariaConnection::getInstance();
  35. echo json_encode(($maria->existsEmail($email)) ? 'true' : 'false');
Add Comment
Please, Sign In to add comment