Open waswebb opened 7 years ago
We are planning to add this option in time.
+1 would love to see this added.
It seems to handle ajax submissions just fine for me? Am I missing something here?
@thisisjamessmith are you just submitting to 'amForms/submissions/saveSubmission' via ajax?
The following doesn't work for me, getting 404;
var xhr = new XMLHttpRequest();
xhr.open('POST', 'amForms/submissions/saveSubmission', true);
xhr.setRequestHeader('Accept', 'application/json; charset=utf-8');
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
// Send the collected data as JSON
xhr.send(JSON.stringify(formData));
No, I'm submitting to the form's action attribute (which is actually empty, so defaults to posting to the current page).
I'm using jQuery - something like this:
ajaxSubmit: function($form, $thanks, e){
e.preventDefault();
$.ajax({
type:'POST',
url: $form.attr('action'),
data: $form.serialize(),
cache: false
}).done(function(data){
//success...
if (data.success){
// remove loading and show success message
}
// errors...
else{
if (data.errors){
$.each(data.errors, function(field, msgs){
// show errors by each errored field
});
}
}
});
},
Ahh ok great, I'll give that a go. Thanks!
@thisisjamessmith You save my day! Thank you!
Hi
First i want to say that this plugin is a very cool one. I like your work, thx.
But it would be nice to have the option to send the form over Ajax. Do you plan to add this option?