I need to add my captcha in a pop up but there are some stuff that need to be handled. first of all as i get the captcha from back-end its a php class, and secondly i need to add the object in an external js script,
so far i assigned the object to a variable in my blade file as below:
<script>
var captchaVar = '{!! NoCaptcha::display() !!}'
</script>
and for pop up I have the following code in my script file
.confirm({
title: 'Confirm!',
content: '<div class="col-xs-12">
' +
'<div class="cr-item">
' +
'<label class="inl-blk">security code</label>
' +
'<div class="inp area inl-blk">
' +
+ captchaVar + '
' +
'</div>
' +
'</div>
' +
'</div>',
buttons: {
confirm: function () {
$(this).submit();
},
cancel: function () {
}
}
});
I get NaN instead of captchaVar which should be
<div class="g-recaptcha" data-sitekey=""></div>
.confirm({
title: 'Confirm!',
content: '<div class="col-xs-12">
' +
'<div class="cr-item">
' +
'<label class="inl-blk">security code</label>
' +
'<div class="inp area inl-blk">
' +
captchaVar + '
' +
'</div>
' +
'</div>
' +
'</div>',
buttons: {
confirm: function () {
$(this).submit();
},
cancel: function () {
}
}
});
There was a plus too much in your code. It then created the NaN instead of the expected result.