chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] ajax egg


From: Daishi Kato
Subject: Re: [Chicken-users] ajax egg
Date: Thu, 06 Oct 2005 15:24:27 +0900
User-agent: Wanderlust/2.15.1 (Almost Unreal) Emacs/21.4 Mule/5.0 (SAKAKI)

At Mon, 03 Oct 2005 18:53:43 -0000,
Thomas Chust wrote:
> > I would think more how to improve ajax.scm.
> > Basically, support of script-enabled(?) paremeters
> > and evalScripts=yes would be nice.
> 
> Cool, looks more than promising!

Thanks.

Here is my idea of a patch to ajax.scm, not tested.
There might be a better way for arguments handling.

Daishi

8<------8<------8<------8<------8<------8<------8<------8<------

--- ajax.scm.orig       2005-09-22 05:50:46.000000000 +0900
+++ ajax.scm    2005-10-06 15:17:15.000000000 +0900
@@ -56,19 +56,21 @@
         (printf "\r\n~a" body) ) ) )
     (if (null? arguments)
        url
-       (string-append url "?" (encode-arguments arguments)) ) ) )
+       (string-append url "?" (if (string? arguments) arguments 
(encode-arguments arguments))) ) ) )
 
 (define (remote-action thunk #!key (arguments '()) 
                       update insert-before insert-after insert-top 
insert-bottom 
-                      method success failure name frequency decay)
+                      method success failure name frequency decay eval-scripts)
   ;; missing "requestHeaders" option
   (let ((url (remote-url thunk))
        (options '())
        (updater "Updater") )
     (define (addopt x y)
-      (set! options (cons (conc x ": " y) options)) )
-    (when method (set! options (cons (sprintf "method: '~a'" method) options)))
-    (when (pair? arguments) (addopt "parameters" (sprintf "'~a'" 
(encode-arguments arguments))))
+                 (set! options (cons (conc x ": " y) options)) )
+    (when method (addopt "method" (sprintf "'~a'" method)))
+    (cond ((pair? arguments) (addopt "parameters" (sprintf "'~a'" 
(encode-arguments arguments))))
+          ((string? arguments) (addopt "parameters" arguments)))
+    (when eval-scripts (addopt "evalScripts" eval-scripts))
     (let ((out
           (cond (update (sprintf "new Ajax.~~a('~a', '~~a', { ~~a });" update))
                 (insert-before




reply via email to

[Prev in Thread] Current Thread [Next in Thread]