Unfortunately, AJAX submissions are now reserved for Gold users on Formspree.
To get around this, you can create a <form> element and programatically submit it, like so:
function submitForm(name, email, message){
var destinationEmail = "[email protected]";
var form = document.createElement('form');
form.setAttribute("action", "https://formspree.io/" + destinationEmail)
form.setAttribute("method", "POST")
// Subject for your email
var field = document.createElement("input");
field.setAttribute("type", "hidden");
field.setAttribute("name", "_subject");
field.setAttribute("value", "Contact form submitted");
form.appendChild(field);
// Contact email address
field = document.createElement("input");
field.setAttribute("type", "hidden");
field.setAttribute("name", "email");
field.setAttribute("value", email);
form.appendChild(field);
// Your user's name
field = document.createElement("input");
field.setAttribute("type", "hidden");
field.setAttribute("name", "name");
field.setAttribute("value", name);
form.appendChild(field);
// The text message
field = document.createElement("input");
field.setAttribute("type", "hidden");
field.setAttribute("name", "message");
field.setAttribute("value", message);
form.appendChild(field);
document.body.appendChild(form);
form.submit();
}
submitForm("Your user's name", "[email protected]", "Here is my message");
The downside is that your email address will be displayed on the address bar, and the browser will show a captcha before continuing.
However, I've found that after several submissions the Rest API actually starts to work fine.
Hope it helps