Hi I am still learning this JSON stuff…
I think I found a valid JSON:
http://www.nfl.com/liveupdate/scorestrip/ss.json
Problem is I am not sure how I can parse this using AJAX?
Is this possible to do? I have also heard of MooTools what is the difference?
Also here is some code I have just to play around but doesn’t seem to work:
$.ajax({
type: "GET",
url: "http://www.nfl.com/liveupdate/scorestrip/ss.json",
dataType: "json",
success: function(data) {
// Interpret response
for (var i = 0; i < data.gms.length; i++) {
document.write("Day: " + data.gms[i][0]);
document.write("<br/>");
document.write("Time: " + data.gms[i][1]);
document.write("<br/><br/>");
}
}
});
JSON stands for “JavaScript Object Notation”. AJAX stands for “Asynchronous Javascript And XML”. MooTools is a crossbrowser javascript framework which provides developers an object oriented workflow with javascript.
Don’t confuse apples with peas. All three technologies are often used together, but are different things. JSON is a notation to describe javascript objects, arrays and literals; AJAX is for requesting and retrieving documents (including documents in JSON format) and MooTools can be used to make AJAX calls (probably retrieving a document in JSON format – or an XML fragment).
JSON is pure javascript, there is no need to “parse” it in any way, the javascript interpreter will do that for you. AJAX is often used to describe XMLHttpRequests: http requests originating from javascript, often retrieving JSON or XML/HTML data. MooTools allows you with relatively little code to make use of the XMLHttpRequest feature trough its
Requestclass: