Newer
Older
codeigniter4-recaptcha / Views / init_v2.php
@denis303 denis303 on 22 Oct 2020 598 bytes n/a
<?php

$options['sitekey'] = $key;
$options['callback'] = 'reCaptcha2VerifyCallback_' . $num;

?>

<div id="reCaptcha2_<?= $num;?>"></div>

<script type="text/javascript">

    var reCaptcha2VerifyCallback_<?= $num;?> = function(response) {
        document.getElementById('<?= $id;?>').value = response;
    };

    var reCaptcha2Callback_<?= $num;?> = function() {
        grecaptcha.render('reCaptcha2_<?= $num;?>', <?= json_encode($options);?>);
    };
</script>

<script src="https://www.google.com/recaptcha/api.js?onload=reCaptcha2Callback_<?= $num;?>&render=explicit" async defer></script>