0
Colleagues.
I took a project that already includes the shooting of emails with PHP/Ajax, the shooting occurs normally, but the fields are not cleaned after the shooting. I tried to put form.value(); but it still doesn’t work. Below 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;
})
Perfect Jasar. Thank you very much. I will give as acceptable your reply, however I have to wait 3 minutes.
– user24136
out of nowhere I helped
– Jasar Orion