Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sendEmail(val1, val2, val3) {
- val1 = prompt('Prompt2 for ' + val2 + ':', val1);
- console.log('Val1: '+ val1);
- if(val1) {
- let xhr = $.ajax({
- method: 'POST',
- url: 'send-email',
- // Tried with and without stringify
- data: JSON.stringify({param1: val1, param2: val2, param3: val3}),
- contentType: "application/json; charset=utf-8",
- dataType: 'text',
- cache: false,
- traditional: true
- }).done(function(){
- alert("Sent!");
- }).fail(function(data){
- console.log("Info:");
- console.log(xhr.responseText);
- alert('Failed to send');
- });
- }
- console.log("Ret false?");
- return false;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement