Importing a JSON feed from an external source into Javascript
2 answers
jQuery to get some JSON data might look like this:
$.getJSON("http://pathtodata.js", function(json){
alert(json.dot.notation);
});
A source with a callback function is specified. Read in the JQuery JSON documentation: http://api.jquery.com/jQuery.getJSON/
+5
a source to share
Javascript XMLHTTPRequest has a single domain origin policy, so you'll only be limited to loading data from URLs from the same domain your script was loaded from. JSONP is one way to get around this. Another way is to use a proxy script on your domain that makes its own HTTP calls in turn for you. For more information on JSONP, check out this article:
+4
a source to share