Hello again, I am working with base om tutorial by David Nolan. But I am with a problem when I try send a POST to my back-end. Basically I use the same code from om tutorial. I test back-end separately e it works as expects:
curl -X POST -d "foo=bar" http://localhost:10555/posts Params: {:foo "bar"}% Bu when I trying from ClojureScript the params is empty. I do: Code from Om tutorial: (def ^:private meths {:get "GET" :put "PUT" :post "POST" :delete "DELETE"}) (defn edn-xhr [{:keys [method url data on-complete]}] (let [xhr (XhrIo.)] (events/listen xhr goog.net.EventType.COMPLETE (fn [e] (on-complete (reader/read-string (.getResponseText xhr))))) (. xhr (send url (meths method) (when data (pr-str data)) #js {"Content-Type" "application/edn"})))) The request: (edn-xhr {:method :post :url (str "posts") :data {:name "Foo Bar"} :on-complete (fn [res] (println "server response:" res))}) ) ;;=> server response: I don't figured out whats is the problem here. If I missed some important information in this post, please, let me know. Thanks in advance. -- 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.
