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 -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -