(ajax-lite uri
{:keys [method params headers timeout-ms resp-type with-credentials?]
:as opts
:or {method :get timeout-ms 10000 resp-type :auto}}
callback-fn)
(ajax-lite "/my-post-route" {:method :post :params {:username "Rich Hickey" :type "Awesome"} :headers {"Foo" "Bar"} :resp-type :text :timeout-ms 7000 :with-credentials? false ; Enable if using CORS (requires xhr v2+) } (fn async-callback-fn [resp-map] (let [{:keys [success? ?status ?error ?content ?content-type]} resp-map] ;; ?status - e/o #{nil 200 404 ...}, non-nil iff server responded ;; ?error - e/o #{nil <http-error-status-code> <exception> :timeout :abort :http-error :exception :xhr-pool-depleted} (js/alert (str "Ajax response: " resp-map))))) [1] Ref. https://developers.google.com/closure/library/docs/xhrio
(ajax-lite "/my-post-route" {:method :post :params {:username "Rich Hickey" :type "Awesome"} :headers {"Foo" "Bar"} :resp-type :text :timeout-ms 7000 :with-credentials? false ; Enable if using CORS (requires xhr v2+) } (fn async-callback-fn [resp-map] (let [{:keys [success? ?status ?error ?content ?content-type]} resp-map] ;; ?status - e/o #{nil 200 404 ...}, non-nil iff server responded ;; ?error - e/o #{nil <http-error-status-code> <exception> :timeout :abort :http-error :exception :xhr-pool-depleted} (js/alert (str "Ajax response: " resp-map))))) [1] Ref. https://developers.google.com/closure/library/docs/xhrio
(assoc-key state ks new-key)
(assoc-some m kvs)
(assoc-some m k v)
(assoc-some m k v & kvs)
Assocs each kv iff its value is not nil.
Assocs each kv iff its value is not nil.
(available-height)
(available-width)
(browser)
(browser-engine)
(browser-lang)
(browser-languages)
(browser-mimes)
(browser-name)
(browser-plugins)
(browser-version)
(by-id id)
Short-hand for document.getElementById(id)
Short-hand for document.getElementById(id)
(charset)
(client-time)
(color-depth)
(connection)
(cookies)
(cookies?)
(cpu-cores)
(deaccent input)
(debounce listener interval)
(deep-merge v & vs)
(disposable->function disposable listener interval)
(dissoc-in m [k & ks :as keys])
(dom-ready event)
(domain)
(drop-nth n coll)
(event->value event)
(extension s)
(fancy sample)
(format* fmt args)
(formato fmt & args)
(host)
(host-name)
(jsx->clj x)
(local-storage)
(media-devices)
(mobile?)
(nil->str x)
(obj->clj obj)
(on-click id event)
(on-key-press id event)
(online?)
(os)
(pc?)
(performance-memory)
(performance-timing)
(pixel-depth)
(pr-edn x)
(pr-edn _opts x)
Prints arg to an edn string readable with read-edn
.
Prints arg to an edn string readable with `read-edn`.
(prev-sites)
(protocol)
(read-edn s)
(read-edn opts s)
(redirect! loc)
(reduce-kvs rf init kvs)
Like reduce-kv
but takes a flat sequence of kv pairs.
Like `reduce-kv` but takes a flat sequence of kv pairs.
(referrer)
(round x & {p :precision})
(rsome pred coll)
(safe-read value)
(screen-height)
(screen-width)
(search in filter-string)
(set-display! id update)
(set-html! id s)
(set-val! id update)
(str-contains? s substr)
(str-starts-with? s substr)
(tablet?)
(throttle listener interval)
(timestamp)
(timezone)
(title)
(title! t)
(url-hash)
(url-path)
(user-agent)
(val-by-id id)
(viewport)
(window-location)
Returns js/window
's current location as a map.
Returns `js/window`'s current location as a map.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close