var initRec;
function initRecaptcha(modal) {
var captcha = modal.find(".g-recaptcha");
initRec = grecaptcha.render(captcha.attr("id"), {
"sitekey" : "6LekN5cUAAAAAK8F0b2qro4u4UoFiHwW9cXeHkE2",
"callback" : function(token) {
captcha.parent().find(".g-recaptcha-response").val(token);
captcha.parent().submit();
}
});
}
$('.usluga1_btn').click(function() {
$('.usluga1_popup').bPopup({
closeClass: 'close',
follow: [isFollow, isFollow],
onOpen: function() {
$('#captcha1').before('<div id="recaptcha1" class="g-recaptcha" data-callback="onSubmit" data-size="invisible"></div>');
initRecaptcha($(this));
},
onClose: function() {
$('#recaptcha1').remove()
grecaptcha.reset(initRec);
}
});
});