Dave's Brain

Date: 2009oct15
Language: javaScriptLibrary: jQuery
Q. How can I do a C-like #include in javaScript?
A. There is no equivalent to a #include is javaScript.
But you can use Ajax to pull in a .js file and then run it!
Here's how to do that with jQuery:

$.ajax({
type: 'GET',
url: 'my_script.js',
dataType: 'script'
});

Or even simpler:

$.getScript(url, callback);

You can do this in pure javaScript too.
Search for "Ajax" here for more info.