javascript - Why getScript does not work from an external script? -


i trying google recaptcha script loaded with

$.getscript("https://www.google.com/recaptcha/api.js?onload=onloadcallback&render=explicit"); 

if put <script> tags , inline webpage, loades captcha correctly, while if include getscript, inside external .js file still hosted on same domain javascript recaptcha not loaded. problem script or getscript?

the script you're calling rendered when 'onload' event fires.

(function() {   if (!window['___grecaptcha_cfg']) {      window['___grecaptcha_cfg'] = {};    };   if (!window['___grecaptcha_cfg']['render']) {       // if render time isn't set, set (window) onload //      window['___grecaptcha_cfg']['render'] = 'onload';           };   window['__google_recaptcha_client'] = true;   var po = document.createelement('script');    po.type = 'text/javascript';    po.async = true;po.src = 'https://www.gstatic.com/recaptcha/api2/r20150826120751/recaptcha__en.js';   var s = document.getelementsbytagname('script')[0];    s.parentnode.insertbefore(po, s); })(); 

i'm not familiar google captcha specs, think can work. need find script url executes in context. hint: url won't 'onload=onloadcallback' in it.


Comments

Popular posts from this blog

swift - Button on Table View Cell connected to local function -

dns - Dokku server hosts two sites with TLD's, both domains are landing on only one app -

c# - ajax - How to receive data both html and json from server? -