简体   繁体   中英

How to do a Hoplon CLJS Server or AJAX Call

I am using Hoplon to create a fairly simple site and an stuck on the AJAX part. In the past I have used Castra as the backend but since it is no longer maintained I have switched to a normal LuminusWeb backend. I am in need of making a call to the server in which I will the server and then wait for a response. I know how to do it on the server side but I can't seem to find any information about how to do it on the Hoplon Client side.

How can I send a request to the server using an AJAX call?

I know how to do it in jQuery and assume, possibly wrongly, there is something similar to $.POST in Hoplon.

Cheers

The best way to solve this AJAX problem that I found is to use the library 'cljs-http' and then you can make an synchronous request using a call such as:

(http/post "http://localhost:8080/" {:with-credentials? false})

Then, on the cljs-http GitHub README.md it gives plenty of examples so you can then do asynchronous in Hoplon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM