#!/usr/bin/csi -script (use posix awful html-tags spiffy-request-vars) (enable-ajax #t) (define-page (main-page-path) (lambda () (define (show-secs) (->string (current-seconds))) (ajax "/single" 'single 'click show-secs target: "single-target") (ajax "/bind" 'bind '(click dblclick) show-secs target: "bind-target") (ajax "/live" 'live '(click dblclick) (lambda () (++ (show-secs) ( href: "#" id: "after-life" "Click me again"))) target: "live-target") (ajax "/after-life" 'after-life 'click show-secs target: "after-life-target" live: #t) (++ (

"Single event") ( href: "#" id: "single" "Click me") (
id: "single-target") (

"Multiple events (bind)") ( href: "#" id: "bind" "Click me") (
id: "bind-target") (

"Live events") ( href: "#" id: "live" "Click me") (
id: "live-target") (
id: "after-life-target") (
) (ajax-link "foo" 'alink "a link" (lambda () ( ($ 'bar))) target: "baz" arguments: '((bar . "$('#value').html()"))) (
id: "value" "value") (
id: "baz") (
) (

"content-length != 0") (ajax-link "secs" 'getsecs "Get seconds from single (first example)" (lambda () ($ 'secs)) target: "secs" arguments: '((secs . "$('#single-target').html()"))) (
id: "secs") )))