javascript - How to run script after jQuery.getScript is called? -


i have use case checking if code on page, if not use $.getscript fetch script. in done trying call function in script gives error uncaught referenceerror: listinit not defined. have set interval check function, not finding it. way call function in external calling in? here script call, , function in external:

get script:

jquery.getscript(scripturl)       .done(function() {         listinit(listoptions);       }); 

function in external called in:

var listinit = function(options) {     console.log(options) } 

i can see in network tab call , response shows minified code. have tried see if function available:

jquery(document).ready(function(){   var findlistfunction = setinterval(function(){     if (typeof listinit !== 'undefined' && $.isfunction(listinit)) {       console.log('its available')     }else{       console.log('no such function')     }   },1000); }); 

edit:

i put console log in external file outside of function. console log executed once external called in. cant seem function run.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -