Skip to content

Instantly share code, notes, and snippets.

@ajchemist
Created July 6, 2015 22:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajchemist/e57f15d00bd7c4157077 to your computer and use it in GitHub Desktop.
Save ajchemist/e57f15d00bd7c4157077 to your computer and use it in GitHub Desktop.
(def tumblr-url "http://pipes.yahoo.com/pipes/pipe.run?_id=4ddef10340ec6ec0374cbd0f73bce819&_render=json")
(defn display-count [json-obj]
(let [data (js->clj json-obj :keywordize-keys true)
post-count (:count data)]
(js/alert (str "Number of posts: " post-count))))
(defn display-items [json-obj]
(let [data (js->clj json-obj :keywordize-keys true)
items (:items (:value data))
titles (map :title items)]
(js/alert (pr-str titles))))
(defn retrieve-tumblr [callback error-callback]
(.send (goog.net.Jsonp. tumblr-url "_callback")
"" callback error-callback))
(retrieve-tumblr display-items #(js/alert (str "An error occurred: " %)))
@iku000888
Copy link

I get a goog.net.Jsonp is not a constructor error for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment