[hunchentoot-devel] ht-simple-ajax
Haris
fbogdanovic at xnet.hr
Thu Apr 7 16:44:13 UTC 2011
I had to move to Internet Explorer again because it stopped working in
Firefox.
I started to debug javascript and on
alert (response.firstNode.firstNode.nodcValue)
it says that firstNode.firstNode is not an object ?
---------------------------------------------------------------------------------------------------------------
(defpackage ajax (:use :cl :hunchentoot :cl-who :parenscript
:ht-simple-ajax))
(in-package ajax)
(setf *access-log-pathname* "c:/lisp/hunchentoot-log/access.log")
(setf *message-log-pathname* "c:/lisp/hunchentoot-log/message.log")
(setf *js-string-delimiter* #\")
(defparameter *ajax-processor*
(make-instance 'ajax-processor :server-uri "/ajax"))
(push (create-ajax-dispatcher *ajax-processor*) *dispatch-table*)
(push (create-prefix-dispatcher "/" 'index) *dispatch-table*)
(defun-ajax show-number () (*ajax-processor*)
"10")
(defun index ()
(with-html-output-to-string (*standard-output* nil :prologue t :indent t)
(:html :xmlns "http://www.w3.org/1999/xhtml"
(:head
(:title "ht-simple-ajax demo")
(princ (generate-prologue *ajax-processor*))
(:script :type "text/javascript"
(str
(ps
(defun callback (response)
(alert (chain response first-node first-node node-value)) ;
ERROR: firstNode.firstNode
0)))))
; is not an object
(:body
(:p (:a :href (ps-inline (ajax_show_nuimber callback)) "Show
number"))))))
More information about the Tbnl-devel
mailing list