Make a simple ajax request in ClojureScript
Clojure
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test/simple_xhr
.gitignore
README.md
project.clj

README.md

simple-xhr

A ClojureScript library designed to make a simple ajax request.

Usage

[simple-xhr "0.1.3"]
(ns myapp
  (:require [simple-xhr :as sxhr]))

(sxhr/request
  :url "/api/messages"
  :method "POST"
  :json {:title "hello" :body "world"}
  :complete
  (fn [xhrio]
    (let [content (-> xhrio
                      .getResponseJson
                      (js->clj :keywordize-keys true))]
      (when (.isSuccess xhrio)
        (.log js/console content)))))

License

Distributed under the Eclipse Public License, the same as Clojure.