Skip to content

Instantly share code, notes, and snippets.

@dsosby dsosby/gist:1823881
Created Feb 14, 2012

What would you like to do?
Jsonp & Clojurescript
(def tumblr-url "")
(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 ( tumblr-url "_callback")
"" callback error-callback))
(retrieve-tumblr display-items #(js/alert (str "An error occurred: " %)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.