Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. function sendEmail(val1, val2, val3) {
  2. val1 = prompt('Prompt2 for ' + val2 + ':', val1);
  3. console.log('Val1: '+ val1);
  4. if(val1) {
  5. let xhr = $.ajax({
  6. method: 'POST',
  7. url: 'send-email',
  8. // Tried with and without stringify
  9. data: JSON.stringify({param1: val1, param2: val2, param3: val3}),
  10. contentType: "application/json; charset=utf-8",
  11. dataType: 'text',
  12. cache: false,
  13. traditional: true
  14. }).done(function(){
  15. alert("Sent!");
  16. }).fail(function(data){
  17. console.log("Info:");
  18. console.log(xhr.responseText);
  19. alert('Failed to send');
  20. });
  21. }
  22. console.log("Ret false?");
  23. return false;
  24. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement