var urlFunc1 = "https://primeplanitfunction.azurewebsites.net/api/Function1?code=t4HtnljBGI7vJgZdwtPQzVK2E4dxjlJSpqeGKGXqT1j8ZCQONywvjQ=="; $("#contactForm").on('submit', function (event) { event.preventDefault(); // grab contact form data var data = $(this).serialize(); // hide prior errors, disable inputs while we're submitting $("#contactFormError").hide(); $("#contactForm input").prop('disabled', true); $("#contactFrom").prop('display', 'none'); var phoneNumber = iti.getNumber(intlTelInputUtils.numberFormat.E164); console.log("Phone Number: " + phoneNumber); var dataWithPhone = data + "&phone=" + phoneNumber + "&formType=3" + "&emailsubject=Prime Planit Contact Form" + "&mailinglist=Prime Planit Mailing List"; console.log(dataWithPhone); $.ajax({ type: "POST", url: urlFunc1, data: dataWithPhone, dataType: "text", headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, success: function (respData) { // Yay, success!! $("#contact-response").html("
" + respData + "
"); }, error: function (jqXHR) { // Boo, error... $("#contactFormError").html("
Sorry, an error occurred: " + jqXHR.responseText + "
"); $("#contactFormError").show(); $("#contactForm input").prop('disabled', false); } }); }); $("#sunchaserMailingForm").on('submit', function (event) { event.preventDefault(); // grab contact form data var data = $(this).serialize(); // hide prior errors, disable inputs while we're submitting $("#contactFormError").hide(); $("#contactForm input").prop('disabled', true); $("#contactFrom").prop('display', 'none'); var dataWithPhone = data + "&formType=1" + "&emailsubject=Sunchaser Mailing List Subscription " + "&mailinglist=Sunchaser Mailing List"; $.ajax({ type: "POST", url: urlFunc1, data: dataWithPhone, dataType: "text", headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, success: function (respData) { // Yay, success!! $("#contact-response").html("
" + respData + "
"); }, error: function (jqXHR) { // Boo, error... $("#contactFormError").html("
Sorry, an error occurred: " + jqXHR.responseText + "
"); $("#contactFormError").show(); $("#contactForm input").prop('disabled', false); } }); }); $("#membersWaitingListMailingForm").on('submit', function (event) { event.preventDefault(); // grab contact form data var data = $(this).serialize(); // hide prior errors, disable inputs while we're submitting $("#contactFormError").hide(); $("#contactForm input").prop('disabled', true); $("#contactFrom").prop('display', 'none'); var dataWithPhone = data + "&formType=1" + "&emailsubject=Members Waiting List Mailing List " + "&mailinglist=Members Waiting List"; $.ajax({ type: "POST", url: urlFunc1, data: dataWithPhone, dataType: "text", headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, success: function (respData) { // Yay, success!! $("#contact-response").html("
" + respData + "
"); }, error: function (jqXHR) { // Boo, error... $("#contactFormError").html("
Sorry, an error occurred: " + jqXHR.responseText + "
"); $("#contactFormError").show(); $("#contactForm input").prop('disabled', false); } }); });