Is There Any Way To Include a Javascript File Inside Another JS File?
<p>I have tried 3 suggestions found in other questions on the site but none seem to work for me and I'm not sure why.</p>

<pre><code>// #1
var imported = document.createElement('script');
imported.src = '/path/to/imported/script';
document.getElementsByTagName('head')[0].appendChild(imported);


// #2
// jQuery
$.getScript('/path/to/imported/script.js', function()
{
    // script is now loaded and executed.
    // put your dependent JS here.
});


// #3
document.write( '&lt;script language="javascript" src="myotherscript.js" /&gt;' );
</code></pre>

<p>The file I am trying to include is basically a massive file with variables declared like so:</p>

<pre><code>var agent = [
"csv",
"drawfile",
"excel",
"flash",
"hangul",
"html",
"image",
"msword",
"ooxml",
"pdf",
"ppt",
"txt",
"wmf"];
</code></pre>

<p>Any ideas on what could be causing the problem?</p>

<p><strong>UPDATE</strong></p>

<p>Just an update to say that the JS file that I'm trying to include is generated dynamically from a database, so avoid regular expressions to add and remove the same bit of code constantly I have it stored in a serparate file.</p>

<p>The variables concerend are used to populate a dynamic drop down list with the values, so by not working I mean no values in the dropdowns :(</p>
