   (xhr/send url callback))
 
 
-(defn to-string
-  [obj]
-  (if-let [dt (to-date-time obj)]
-    (time-fmt/unparse (:date-time time-fmt/formatters) dt)))
-
-
 (defn http-post [url callback data]
   (xhr/send url callback "POST" data  (structs/Map. (clj->js {:Content-Type "application/json"}))))
 
 (defn http-delete [url callback data]
   (xhr/send url callback "DELETE" data  (structs/Map. (clj->js {:Content-Type "application/json"}))))
+
+(declare render-documents)
 
 (defn search [event]
   (let [stext (.-value (.getElementById js/document "sText"))

                           [:td (.-documentname dn)]
                           [:td (.-title dn)]
                           [:td (.-employeename dn)]
                           [:td  (f/unparse (f/formatter "MM/dd/yyyy")(f/parse (.-date dn)))]
                           [:td (.-date dn)]
                           [:td (.-location dn)]
                           [:td [:input {:type "button" :on-click #(click-update(.-id dn))
                                         :value "Update"}]]

            :class "btn btn-primary" :on-click docupdate}]])


(defn delete[id]
  (let [onres (fn [json]
                ((reset! documents (getdata json))
                 (r/render [render-documents @documents]
                           (.-body js/document))))]
    (http-delete (str "http://localhost:8193/documents/delete/" id) nil onres)))


(defn render-documents [documents]
