Because you're working with AJAX, you do not want your server to redirect. You
want to just send the data to the server, and then change the URL of the page
with something like
window.location.href = <job-page-url>
Le samedi 12 septembre 2015 05:34:58 UTC+2, Hari Krishnan a écrit :
> Hello All,
>
>
> I am working on a use case as follows: The UI is with reagent, re-frame for
> subscription & Luminus, and for the backend, I use Compojure. I also tried
> with Liberator, but for simplicity, I am using only Compojure now.
>
> I also use Secretary & cljs-ajax for SPA routing and ajax.
>
> -> User brings up "/person" URL, and use a set of actions. The page data is
> sent to the backend, gets validated and saved to the DB. Then the user has
> to be re-directed to "/job". If there is any error, the errors will be
> displayed on the "/person" page.
>
> There are two application components -- one with the URL "/person",and the
> other with "/job". With each of these, I have a few related pages, and I am
> creating them as SPA with Reagent.
>
> The question is how do I redirect to the "/job"?
>
> Client Side Code (only the the relevant ones)
>
> (POST "/person"
> {:headers {"Accept" "application/clojure"}
> :params @doc
>
> :handler ex-handler
> :error-handler ex-error-handler})
>
> Server:
> (defn process-person []
> (-> (redirect "/job" :permanent)
> (header "Content-Type" "text/html; charset=utf-8")
> (header "Location" "/job")
> )
> )
>
> (POST "/person" [params] (process-person params))
>
> Interestingly, on the console, I can see the HTML for the "job" page. Do I
> have to change the Secretary code to make it happen?
>
> Any help is much appreciated.
>
> Regards,
> Hari
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.