Colleagues.
I've taken a project that already has PHP / Ajax triggered, the triggering normally occurs, but the fields are not cleared after the shot. I already tried putting form.value (); but it still does not work. Here is the code:
/* Contact form ajax Handler
================================================*/
$(".ajax-form").on('submit', function() {
var form = $(this);
var formURL = $(this).attr("action");
var postData = $(this).serializeArray();
$.ajax({
url: formURL,
type: 'POST',
data: postData,
dataType: 'json',
success:function(data, textStatus, jqXHR){
if(data.success==1){
form.find(".alert").fadeOut();
form.find(".alert-success").html(data.message);
form.find(".alert-success").fadeIn(600);
}else{
form.find(".alert").fadeOut();
form.find(".alert-danger").html(data.message);
form.find(".alert-danger").fadeIn(600);
}
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(errorThrown);
}
});
return false;
})