Duplicate question - see: How do you dynamically load a javascript file? (Think C’s #include)
Is there a javascript equivalent of @import? Because using the following way of including another javascript file from within a javascript file doesn't seem very nice and clean.
document.write("<script type='text/javascript' src='something.js'></script>");
Google has something which resembles what I'm looking for but it only works for their hosted files and I don't know how that functions works inside (all their code is compressed)
google.load("maps", "2");
I need this because there are some javascript files that are only used sometimes in my app.