I have on my web server a JS script that I want to be able to read files. My filesystem is like this:
> Root
index.html
read.js
> files
file.txt
This is a very simple task if you are using JQuery - The below example will perform an HTTP GET request (using XMLHttpRequest.as referenced above) and will put the contents into an HTML DOM object with the ID of "result". It will also throw an alert box up once the load is completed.
$( "#result" ).load( "files/file.txt", function() {
alert( "Load was performed." );
});