I'm trying to load a very simple text file (eg: 0 online:
or 1 online: Username
or 2 online: Username, Username
), from a server I control, that changes based on the number of users on a minecraft server, into a javascript var, so that I can eventually load it onto my Pebble and have it more or less live update. (read: no jquery) (also read: I have little to no idea what I'm actually doing, and if there's a better way to do it, lemme know.).
I've done a lot of googling which mostly points me to using JSON and XMLHTTPRequests (edit: XMLHTTPRequests are probably necessary) but they seem overly complex for what I need (which is to take the contents of the text file served up via HTTP, stuff it in a var, and have the Pebble spit it out on the screen.)
How can I, without JQuery, and maybe even without JSON, load the contents of a text file into a javascript var?
Some notes:
- The server is eventually going to be accessed via Hamachi, but if I can get it working even locally I'll be pretty thrilled.
- Following this answer, I get this result. Ditto for local IP.