[cl-json-devel] ajax

Henrik Hjelte henrik at evahjelte.com
Fri Apr 8 22:38:04 UTC 2011


On Fri, Apr 8, 2011 at 11:34 PM, Haris <fbogdanovic at xnet.hr> wrote:
>
> Hi.
>
> How to do ajax with cl-json on Hunchentoot ?
> Can you give me a simple example,
> calling a lisp function from javascript ?

Something like this:

(hunchentoot:define-easy-handler (hello :uri "/hello") (name)
 ;; call with /hello?name=foo
 (setf (hunchentoot:content-type*) "application/json")
 (json:encode-json-plist-to-string `(:msg ,(format nil "Hello ~a" name))))

Disclaimer: Untested..
/Henrik




More information about the cl-json-devel mailing list