I use a restfull api http://applications.opap.gr/DrawsRestServices/kino/last.json
This url returns in json format the "numbers games" that have won in a game called "kino"
the results in browser is something like this:
{"draw":{"drawTime":"18-04-2014T10:15:00","drawNo":437017,"results":[6,9,12,16,17,21,24,26,31,36,38,53,54,55,61,63,67,69,75,79]}}
I am trying to get these numbers by using a jquery function:
function get_game_results_json() {
$.getJSON("http://applications.opap.gr/DrawsRestServices/kino/last.json?callback=?", function(result){
alert(result);
});
}
a) My first problem is that when I go to the tab console of google chrome I have "Uncaught SyntaxError: Unexpected token : "
But att the same time in the tab network I have a response that looks it works
draw: {drawTime:18-04-2014T10:20:00, drawNo:437018,…}
drawNo: 437018
drawTime: "18-04-2014T10:20:00"
results: [6, 8, 15, 28, 32, 33, 37, 38, 39, 40, 45, 50, 58, 59, 68, 69, 72, 75, 79, 80]
Why I have Unexpected token ? Any ideas?
b) Could you suggest a way to parse correctly the json response and store each node of json into a different variable ?
drawNo drawtime results
{"a":"b", ...}is not valid Javascript code, and hence the error. - UltraInstinct:. - Jai