1

I'm new in HTML5 programming. I'm porting my mobile games to HTML5. I have lots of text files which are located on server's folders, so I'd like to read a file from known url and I don't know how to do it. I found a tutorial but there are the file reads from the local folder: http://www.html5rocks.com/en/tutorials/file/dndfiles/

Would you mind provide me an example how to read a serverside file from known url in the simplest way?

Thanks and peace to all!

2 Answers 2

4

Have look to : Jquery Ajax Calling functions

make use of jquery make your task easy

jQuery.get('http://localhost/foo.txt', function(data) {
    var myvar = data;
});
Sign up to request clarification or add additional context in comments.

2 Comments

Also worth noting that you don't need html5 to do this - reading clientside files requires html5 apis, but this works back to IE6.
Exactly. His question incorrectly asked about html5, but the correct answer has nothing to do with html5. I wanted to clarify to Yakov that this isn't a new thing, and doesn't have anything to do with html5.
1

And if you are not using jQuery you can take a look at this Ajax example.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.