0

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

phlie
  • 1,335
  • 3
  • 10
  • 19
  • I have decided to go with the HTTP Kit library and will be posting the steps to get it working. – phlie Jul 07 '18 at 18:08
  • I thought I could do it in CLJS but HTTP Kit seems to only be for Clojure, what is a good library for CLJS Requests. – phlie Jul 07 '18 at 18:20
  • I found and got working "cljs-http" so I will be writing an answer in detail tomorrow. – phlie Jul 07 '18 at 18:25

1 Answers1

0

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.

phlie
  • 1,335
  • 3
  • 10
  • 19