What is wrong with this code ?
$(function() {
$('#my_form').submit(function(e) {
e.preventDefault();
recaptcha_response_field = $('input#recaptcha_response_field').val();
recaptcha_challenge_field = $('input#recaptcha_challenge_field').val();
$.post('controller.php', {recaptcha_response_field : recaptcha_response_field, recaptcha_challenge_field : recaptcha_challenge_field}, function(data) {
if(data == 0) {
alert('no');
} else {
alert('submit')
$('#my_form').submit();
}
});
})
});
I use recaptcha in my form. When the user entered correctly the captcha code these lines of code are executed
alert('submit')
$('#my_form').submit();
So fat so good. The problem is that the form is not getting to submit. I think this line of code is executed again
$('#my_form').submit(function(e) {
Any suggestions ?