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.

Asyncio Basics Python 35

# Asyncio basics in pythonPython 3.5 brought with it asyncio. An event loop based paradigm previously available as a library but now it i...… Continue reading

Quick Laravel/Lumen install with Docker!

Published on March 02, 2016

PHP To Python

Published on February 24, 2016