How do I load the contents of a text file into a javascript variable?
<p>I have a text file in the root of my web app <em><a href="http://localhost/foo.txt">http://localhost/foo.txt</a></em> and I'd like to load it into a variable in javascript.. in groovy I would do this:</p>

<pre><code>def fileContents = 'http://localhost/foo.txt'.toURL().text;
println fileContents;
</code></pre>

<p>How can I get a similar result in javascript?</p>
