I am making a form to send messages from my website, which I am doing with jquery
and ajax
, using the reCAPTCHA
of Google with the title.
The messages are sent correctly, but the point is that when sending the email the reCAPTCHA
is marked as valid , even though I restart the form. I was using the following statement grecaptcha.reload();
but it has no effect.
My code:
$.ajax({
beforeSend:function(){
init_load();
},
url: base_url+'site/send_email',
type:'POST',
cache:false,
data: formData,
success:function(response){
end_load();
if(response.trim() === 'success'){
$('#form-send-message')[0].reset(this);
grecaptcha.reload();
end_load_message('Gracias Tu Mensaje Fue Enviado Correctamente');
}else if(response.trim() === 'error-c'){
load_alert('Comprueba que no eres un Robots');
}else{
grecaptcha.reload();
load_message_error('Tu Mensaje No Pudo Ser Enviado Intente Nuevamente');
}
}
});