Loading Javascript file at runtime.

There are many scenarios where you want your file to be include at run time based on your requirement. Here is the code snippet for that. I am using the Jquery.getScript method for this feature.
I came up with this idea by looking how EXTJs is forcing the folder structure in MVC architecture.

It looks like a complex example but it is not. Util.load searches for All the files which are defined in modal variable and specifically in model folder. Here it is searching for /model/Person.js

Please feel free to comment.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Leave a Reply

Your email address will not be published. Required fields are marked *