On Fri, Dec 3, 2010 at 2:24 PM, apple <simo...@gmail.com> wrote: > When should you use AJAX rather than a standard web request? At what > level of usage would I find the page refresh method becomes a > performance issue?
I think it's best you take a look at examples on the Web and use whatever pattern you find makes sense. Various web serivces and how they use AJAX. Gmail would be a perfect example. Imagine Gmail refreshing a page every time. It would have to reload the HTML, then the browser would have to ask server for all static stuff, and it would get 304 (Not modified) on most of them, but you still waste the requests, etc. With AJAX, you only request for the actual data. Also, I'd suggest you use JSON as a return value, and use a jQuery templating system[1] to make the HTML that you would inject into the DOM. I'm actually going a bit further, and currently experimenting with a simple one-file Python script[2] on the server-side and tons of JavaScript client-side. Basically, the idea is to use the server as a mere extension of the app, and most of the app is written in JavaScript (mootools[3]), using JSONRPC plugin I've developed recently[4]. [1] http://plugins.jquery.com/project/jquerytemplate [2] http://json-rpc.org/wiki/python-json-rpc [3] http://mootools.net/ [4] http://mootools.net/forge/p/jsonrpc -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group