Guest User

Untitled

a guest
Aug 8th, 2018
1,277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. check json availablility
  2. function isUniqueEmail(email) {
  3. $.getJSON('info/mail.json', function(json) {
  4. var response = json.mail
  5. if(response == email){
  6. alert("Your email is already on our list");
  7. }
  8.  
  9. else {
  10. emailWrite(email);
  11. };
  12. });
  13. };
  14.  
  15. {"mail":
  16. [
  17. "tom@gmail.com",
  18. "fred@gmail.com",
  19. "bob@gmail.com"
  20. ]}
  21.  
  22. function isUniqueEmail(email) {
  23. $.getJSON('info/mail.json', function(json) {
  24. var response = json.mail
  25. $(json).each(function(){
  26. if(this.mail == email){
  27. alert("already gotcha")
  28. }
  29. else {emailWrite(email)
  30. }
  31. });
  32. });
  33. };
  34.  
  35. $(json).each(function(){
  36. if(this.mail == email){
  37. // already on list
  38. }else{
  39. // writeEmail
  40. }
  41. });
Add Comment
Please, Sign In to add comment