Created
July 24, 2011 14:01
-
-
Save billdozr/1102641 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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