Re: Pico, handling requests from jQuery

2008-05-27 Thread Jon Kleiser
Hi Alex, Hi Jon, Could it be me doing something wrong in Pico Lisp? Here are the first few lines on my request handler: (de getDirectory () (let Path (get 'path 'http) (out NIL (println "getDirectory request" Path)) (httpHead "text/javascript; charse

Re: Pico, handling requests from jQuery

2008-05-27 Thread Alexander Burger
Hi Jon, > Could it be me doing something wrong in Pico Lisp? Here are the first > few lines on my request handler: > > (de getDirectory () > (let Path (get 'path 'http) > (out NIL (println "getDirectory request" Path)) > (httpHead "text/javascript; charset=utf-8

Re: Pico, handling requests from jQuery

2008-05-27 Thread Alexander Burger
Hi John, > The + shows up in post data too, when the default "application/x-www- > form-urlencoded" content type is used and there are spaces in a value. Thanks. I was not aware of that (or forgot about it), perhaps because the picoLisp server exclusively uses content type "multipart/form-data".

Re: Pico, handling requests from jQuery

2008-05-27 Thread John Duncan
The + shows up in post data too, when the default "application/x-www- form-urlencoded" content type is used and there are spaces in a value. On 27 May 2008, at 5:16 AM, Alexander Burger wrote: > Hi Jon, > >> properly. I get the "+" in Pico Lisp. Therefor I cannot know whether >> a "+" in Pico Li

Re: Pico, handling requests from jQuery

2008-05-27 Thread Jon Kleiser
Hi Alex, > properly. I get the "+" in Pico Lisp. Therefor I cannot know whether a "+" in Pico Lisp originated as a "+" or a space. I think the plus-to-space decoding has to be done at the same time as the %xy decoding. Or ... OK, I understand. As the %xy decoding happens in 'ht:Pack', yo

Re: Pico, handling requests from jQuery

2008-05-27 Thread Alexander Burger
Hi Jon, > properly. I get the "+" in Pico Lisp. Therefor I cannot know whether > a "+" in Pico Lisp originated as a "+" or a space. I think the > plus-to-space decoding has to be done at the same time as the %xy > decoding. Or ... OK, I understand. As the %xy decoding happens in 'ht:Pack', yo

Re: Pico, handling requests from jQuery

2008-05-27 Thread Jon Kleiser
Hi Alex, > space, like "A B", it will turn up in Pico Lisp like "A+B". Is there As a built-in function there is only 'ht:Pack', which is used e.g. in "lib/http.l". But it just decodes hex patterns like "%20": : (ht:Pack (chop "A%20B%20C")) -> "A B C" If you are only concerned about '

Re: Pico, handling requests from jQuery

2008-05-27 Thread Alexander Burger
Hi Jon, > space, like "A B", it will turn up in Pico Lisp like "A+B". Is there As a built-in function there is only 'ht:Pack', which is used e.g. in "lib/http.l". But it just decodes hex patterns like "%20": : (ht:Pack (chop "A%20B%20C")) -> "A B C" If you are only concerned about '+',

Re: Pico, handling requests from jQuery

2008-05-27 Thread Jon Kleiser
Hi Alex, At 09:00 +0200 19-05-08, Jon Kleiser wrote: If I set up the input data for the getJSON call like this: data = {Y: "Y-value", Z: 333}; data["*X"] = 111; ... then I can handle the request in Pico Lisp like this: (de json () (httpHead "text/plain; charset=utf-8") (ht:Out T (

Re: Pico, handling requests from jQuery

2008-05-19 Thread Jon Kleiser
Hi Alex, > 1) How can you know how many (and which) variables that the request contained? The server part anyway must know which variables are relevant (can be expected to be filled by the client). If you cannot guarantee that all variables are filled by the client, I would simply clear the

Re: Pico, handling requests from jQuery

2008-05-19 Thread Alexander Burger
Hi Jon, > 1) How can you know how many (and which) variables that the request > contained? The server part anyway must know which variables are relevant (can be expected to be filled by the client). If you cannot guarantee that all variables are filled by the client, I would simply clear them aft

Re: Pico, handling requests from jQuery

2008-05-18 Thread Jon Kleiser
Hi, Thanks to Firebug, I just found the reason for my problems with string variables containing letters. The way I wrote my little Pico Lisp server, it tried to return a piece of invalid JSON code like "json...({x: 11, y: 2x2});". When I changed it into "json...({x: '11', y: '2x2'});", it worked l

Re: Pico, handling requests from jQuery

2008-05-18 Thread Jon Kleiser
Hi Alex, >> It seems to me that it won't be easy to make use of the Pico Lisp URL >> encoding system when using jQuery AJAX calls like getJSON, as jQuery >> uses >> the more traditional key-value style (http://...?k1=v1&k2=v2...). Is >> there > > No problem at all, I think. It is all there. > > Th

Re: Pico, handling requests from jQuery

2008-05-18 Thread Jakob Eriksson
JSON is basically XML but with parens. I recommend learning it, it is easy and used frequently nowadays. regards, Jakob Alexander Burger wrote: Hi Jon, this is really funny. Just of today I'm working on a similar problem. As I don't know JSON, however, I tried a direct approach with JS. The

Re: Pico, handling requests from jQuery

2008-05-18 Thread Alexander Burger
Hi Jon, > > You can also encode numbers, internal+external symbols, and simple > > lists, if you use 'ht:Fmt' (or 'mkUrl'). > > > >: (pack "http://localhost:8080/@json?"; (ht:Fmt 123 'abc (4 5 6))) > >-> "http://localhost:8080/@json?+123&$abc&_+4_+5_+6"; > > That's nice, but more useful w

Re: Pico, handling requests from jQuery

2008-05-17 Thread Jon Kleiser
Hi Alex, > this is really funny. Just of today I'm working on a similar problem. As > I don't know JSON, however, I tried a direct approach with JS. The > mechanism looks surprisingly similar to what you wrote. JSON is just a data format that is closer to JavaScript than is XML. {x: 11, y: 22, z:

Re: Pico, handling requests from jQuery

2008-05-16 Thread Alexander Burger
Hi Jon, this is really funny. Just of today I'm working on a similar problem. As I don't know JSON, however, I tried a direct approach with JS. The mechanism looks surprisingly similar to what you wrote. > "http://localhost:8080/@json?*JsonCallback=?";, and my server script > does things like t

Re: Pico, handling requests from jQuery

2008-05-16 Thread Jon Kleiser
Hi again, I would like to make a little Pico Lisp HTTP server that can handle XMLHttpRequests from jQuery.getJSON(...), and I wonder if I can use lib/http.l. If you don't know jQuery.getJSON, you can find some info and a nice little demo here:

Pico, handling requests from jQuery

2008-05-16 Thread Jon Kleiser
Hi, I would like to make a little Pico Lisp HTTP server that can handle XMLHttpRequests from jQuery.getJSON(...), and I wonder if I can use lib/http.l. If you don't know jQuery.getJSON, you can find some info and a nice little demo here: