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

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -