Most websites I see go in and over-explain how to grab data, eg. json, from an external website. This is a simple explanation of the SIMPLEST way to nab data.
This is going to go in and grab my gists from github and return the json data.
var url = 'https://api.github.com/users/alairock/gists';
httpr = new XMLHttpRequest();
httpr.open('GET',url, false);
httpr.send();
var statusText = httpr.statusText;
var response = httpr.response;
console.log(response);
1) Get the url we want to nab data from
2) instantiate the XMLHttpRequest object, which is used to go get and handle our data
3) the open method prepares our data to be retrieved and
4) the send method executes our prepared action
5) simply assigns the response message (If successful it will receive "ok")
6) Is the response. This is where all our json data from line 1 is stored.
7) Just outputs the data to our console.