Roman Glass Roman Glass - 6 months ago 59
Ajax Question

ClojureScript Ajax Output

GET is called and when referred to the handler. The result is not the data of the properties, the output is just "null". How can I output the needed value?

(ns places.core
(:require [ajax.core :refer [GET POST]]))

(defn handler [response]
(.log js/console (:sourceId (:_source (:hits (:hits response))))))


The solution was to parse the raw json output like this:

(defn handler [response]
  (.log js/console
        (.. (nth (.. (JSON/parse response) -hits -hits) 0) -_source -sourceId)))