0
I received complaints from some customers that the site was not completing the order, but when checking the code I did not find anything else and for me it works perfectly. The ajax code is this
$.ajax({
type : 'POST',
url : 'www.site.com/functions.php',
data : {func: func, nome: nome, email: email, cel: cel, tamanho: tamanho, modelo: modelo, valor: valor},
dataType : 'json',
timeout : 30000,
cache: false,
beforeSend: function(){
$('div.loading').fadeIn(400);
},
complete: function(response){
$('div.loading').fadeOut(400);
avancar_container(id);
alert(response);
},
success: function(response){
$('div.loading').fadeOut(400);
avancar_container(id);
alert(response);
},
error: function(response){
alert(response);
}
});
the strange thing is that the request is registered in the database, which discards me error in php, but the person does not receive the success message.
Is the data generated in the database correctly? Have you tried leaving some fields unfilled? What
error
andcomplete
return? Already checked the error logs fromphp
and your server? Is the request running out of time? Have you checked the console tab of the "Element Inspector" or similar?– Valdeir Psr
The data in bd is correct, jquery and php check fields. The message returns php echo correctly. The timeout I’m testing now, and it looks functional. The logs and inspector still haven’t looked
– Vinicius
You have two
alert()
after the return? thecomplete
will always run at the end, either of success or error. As it has the same instructions fromsuccess
, will you not be confusing?– Leandro Angelo
I put the complete after to see if it worked, but it didn’t work, I forgot to change when I published.
– Vinicius