Loading Javascript Dynamically and how to check if the script exists

后端 未结 9 562

I am using the following technique to load up Javascript dynamically:

var script = document.createElement(\"script\");
script.type = \"text/javascript\";
scr         


        
9条回答
  •  春和景丽
    2020-12-01 16:56

    What JavaScript library do you use?

    In jQuery if you load the script via Ajax, you have an option to run a success callback function (and other types of callbacks)...

    There is also a dedicated function for loading scripts: $.getScript()

提交回复
热议问题