I have a Meteor app and needs to read data, from a file “/public/_assets/results/mmresults.json”, within the file “/client/controllers.js”.
I do not want to read the json file from within the file “/server/app.js” which is server side codes.
The following is my file “/public/_assets/results/mmresults.json”:
{items:[{“Draw_Date”:‘2016-01-01’,“Number_0”:“1”,“Number_1”:“1”,“Number_2”:“2”,“Nmber_3”:“3”,“Number_4”:“4”,“Number_5”:“5”},{“Draw_Date”:‘2016-01-03’,“Number_0”:“2”, “Number_1”:“2”,“Number_2”:“3”,“Nmber_3”:“4”,“Number_4”:“5”,“Number_5”:“6”}]}
The following is my codes in my “/client/controllers.js” file (client side codes):
$.getJSON("_assets/results/mmresults.json", function(data, status) {
alert("Data: " + data + "\nStatus: " + status);
});
The codes in my controllers.js file doesn’t work. Does $.getJSON work on client side or only works on server side?
Also, my app will be running on iOS 10 iPhone and the mmresults.json file needs to be resided on the iPhone and not on the Meteor server.
Please advice.
Thanks,
Brian