$ .POST在Squarespace页面上

I have a custom form that posts to a 3rd party server as an appointment booking module. If i submit the form thru the action of the <form> tag i do recieve the email, but i would like to submit the form using $.POST so that i can alter the redirect URL.

I have jQuery running successfully on my site, and if i use:

$.post('URL', {data}).then(function () {alert('Form Submitted!')});

The redirect (or alert for this example) works fine, but the POST doesnt seem to actually run. Has anyone had a similar issue and found a way to resolve this?

ACTUAL CODE

I am using mailthis.to's API to avoid having to run a server just to do this

$('#sendForm').click(()=>{
$.post('https://mailthis.to/support@gadget-pro.com', {
  Name:$('#Name').val(),
  Email:$('#Email').val(),
  Phone:$('#Phone').val(),
  Device:$('#device').val(),
  Repair:$('#repairType').val(),
  Price:$('#price').val()
}).then(function (data) {
  location.href = 'https://gadget-pro.com/formconfirm'
});

})

I would say to update your code to return back the page. you are likely not triggering the post to page properly or there is an error. alos console.log the post data before to know what is being sent.

update your code to

console.log(data);
$.post('URL', {data}).then(function (retpage) {console.log(retpage)});