Hi Folks On Thu, 2009-04-09 at 10:20 -0500, P Kishor wrote: > On Thu, Apr 9, 2009 at 9:53 AM, Lyle Brooks <[email protected]> wrote: > > I have a need to incorporate Ajax calls with JSON data into > > our application. I was looking for something in terms of a piece > > of "starter" code or a recipe. I didn't see anything on the website > > related to it. > > > > CGI Application seems like such a robust framework, that this should be > > a natural fit. > > > > Does anyone have a short starter example of code (both server and client) > > that they would be willing to post/share that would show Ajax/JSON > > usage with CGI::Application? > > Short advice... don't. That is, don't mix CGI::App in the backend with > Ajax in the front-end. Keep separate things separate.
Err, .... What? I /think/ you contradict yourself below... > Create your JSON stream (I query the db, and convert the result set > into JSON using JSON.pm) and send it back to the client via > HTML::Template (I have a simple, one variable template with <TMPL VAR > JSON_DB_QUERY> or something like that). Aren't you mixing just like you said you shouldn't? Actually, I do exactly as you do in querying the db, etc. > Use your favorite way of manipulating the data on the client (I use > jQuery to initiate the Ajax call and to deal with the results). I use YUI http://developer.yahoo.com/yui/ which I find superb. One of our list members, Peter Karman, put me on to it. I don't have a simple, stand-alone demo, although I do have a large web-bases address book program I built. And, I do have a full weekend marking papers, but I long been thinking of expanding my CGI::Application::Demo set to include Javascript via YUI, and in particular Ajax. If you can just hold your breathe for a couple of days, I'll see what I can do. In the meantime, install YUI (it's just a matter of unzipping it), and start reading Connection Manager, which is their name for Ajax. Try the demos, etc, etc. Also, tell us a bit about your test env. I run Apache myself, but do use mod_perl except on rare occasions. I do use FCGI::ProcManager. -- Ron Savage [email protected] http://savage.net.au/index.html ##### CGI::Application community mailing list ################ ## ## ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp ## ## ## ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ## ## ################################################################
