Answer the question
In order to leave comments, you need to log in
Why don't two reCAPTCHA sent via ajax work?
The bottom line is that there are two forms, you need to insert two invisible recaptchas into them and send these two forms via ajax.
HTML code:
<script type="text/javascript" src="/main.js"></script>
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
<form id="ShoppingCartFormFast">
<div id="recaptchaFast"></div>
<input type="button" id="SubmitOrderingFast" onClick="CheckBeforeSubmit('#ShoppingCartFormFast');" value="отправить" />
</form>
<form id="ShoppingCartFormStandart">
<div id="recaptchaStandart"></div>
<input type="button" id="SubmitOrderingStandart" onClick="CheckBeforeSubmit('#ShoppingCartFormStandart');" value="отправить" />
</form>
var captchaFast, captchaStandart,
onloadCallback = function() {
mysitekey = 'blabla';
captchaFast = grecaptcha.render('recaptchaFast', {
'sitekey' : mysitekey,
'size' : 'invisible'
});
captchaStandart = grecaptcha.render('recaptchaStandart', {
'sitekey' : mysitekey,
'size' : 'invisible'
});
};
//Проверка формы
function CheckBeforeSubmit(form){
console.log(grecaptcha.Respnse(captchaFast));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question