Ich habe eine Textdatei im Stammverzeichnis meiner Web-App http: //localhost/foo.txt und möchte sie in eine Variable in Javascript laden. In groovy würde ich dies tun:
def fileContents = 'http://localhost/foo.txt'.toURL().text;
println fileContents;
Wie kann ich ein ähnliches Ergebnis in Javascript erzielen?