Quote (MisterTrain @ Jan 28 2015 02:51pm)
You can do something like this:
Code
function readJSON(file) {
var request = new XMLHttpRequest();
request.open('GET', file, false);
request.send(null);
if (request.status == 200)
return request.responseText;
};
var myObject = JSON.parse(readJSON('/local/path/to/json'));
Oh, that looks viable.
so if my file's name was employees.json, then it would be:
JSON.parse(readJSON('employees.json'));?
I'm trying it out and it's being weird.
EDIT: got it, was missing a bracket in my json file.
THANKS!
This post was edited by Rejection on Jan 29 2015 01:02pm