Skip to content

Instantly share code, notes, and snippets.

@jrm2k6
Created June 11, 2012 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrm2k6/2913409 to your computer and use it in GitHub Desktop.
Save jrm2k6/2913409 to your computer and use it in GitHub Desktop.
xhr request coffeescript
(exports ? this).get_pictures_from_tags = () ->
url_img = []
for tag in tags
url_img.push(get_pictures_from_tag tag)
console.log url_img
return
get_pictures_from_tag = (elem) ->
req = new XMLHttpRequest()
req.addEventListener 'readystatechange', ->
if req.readyState = 4
if (req.status = 200) or (req.status = 304)
data = eval req.responseText
console.log 'data message '+req.responseType
else
console.log 'error'
req.open 'GET', "https://api.instagram.com/v1/tags/test/media/recent?client_id=3edf56917c57450f8602173dad5f01dd", true
req.send null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment