Skip to content

Instantly share code, notes, and snippets.

@billdozr
Created July 24, 2011 14:01
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 billdozr/1102641 to your computer and use it in GitHub Desktop.
Save billdozr/1102641 to your computer and use it in GitHub Desktop.
(ns blog
(:require
[goog.Uri :as uri]
[goog.net.XhrIo :as xhrIo]
[goog.events :as events]
[goog.dom :as dom]))
(def essays-uri (goog.Uri. "http://localhost:8080/essays/part"))
(defn retrieve [url callback]
(goog.net.XhrIo/send url callback "GET"))
(defn do-track-refresh-clicked []
(if-let [essay-el (dom/getElement "essay")]
(retrieve essays-uri #(dom/replaceNode
(dom/htmlToDocumentFragment (.. % target (getResponseText)))
essay-el))))
(events/listen (dom/getElement "refresh")
"click"
do-track-refresh-clicked)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment