Getting data from javascript.

Reading time ~1 minute

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);
What is giong on? Line-for-line:
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.

Quick Laravel/Lumen install with Docker!

The default installer that comes with Laravel is great, but unfortunately that means you have to install dependencies of PHP and Laravel/...… Continue reading

PHP To Python

Published on February 24, 2016

Aftertouch in Logic Pro X and 2015 Macbook Pro

Published on February 24, 2016