cljs-ajax example
This commit is contained in:
parent
f5b014864f
commit
f10870268e
3 changed files with 51 additions and 2 deletions
23
resources/public/html/cljs-ajax.html
Normal file
23
resources/public/html/cljs-ajax.html
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="https://borkdude.github.io/scittle/js/scittle.js" type="application/javascript"></script>
|
||||
<script src="https://borkdude.github.io/scittle/js/scittle.cljs-ajax.js" type="application/javascript"></script>
|
||||
<script type="application/x-scittle">
|
||||
(require '[ajax.core :refer [GET]])
|
||||
|
||||
(defn handler [response]
|
||||
(js/alert (str response)))
|
||||
|
||||
(defn make-request []
|
||||
(GET "html/cljs-ajax.html" {:handler handler}))
|
||||
|
||||
;; export function to use from JavaScript:
|
||||
(set! (.-make_request js/window) make-request)
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<button onclick="make_request()">
|
||||
Click me!
|
||||
</button>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue