first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

jQuery: “jQuery loading remote/external javascript files using getScript()”; Stephen Gray

The only issue is that it can take some time to load an external file so you can’t always run functions from within that file straight away. Thankfully there is a workaround for this using another jQuery method. You basically set all AJAX request to be synchronous before you run getScript() and then set AJAX requests to be asynchronous again after the script is loaded. If you end up loading like 20 files at the beginning of a page load this could take a while but hopefully you won’t be doing that :P

$.ajaxSetup({async: false}); $.getScript(MVCRoot+fileName+'.js'); $.ajaxSetup({async: true});

[http://colourgray.wordpress.com/2008/09/22/jquery-loading-external-javascript-files-using-getscript/]

mod date: 2010-03-21T23:28:01.000Z