Some years since I did any programming. Have had some time on my hands
and taught myself python, web2py, jquery, javascript. Fine with all
that. However I have some questions about the general design pattern/
architecture of a web2py application and specifically on use of AJAX.

I have created an application using web2py. It is a bit like a desktop
application so there is a main document area taking 80% of the screen,
and five smaller areas such as a menubar at the top of the screen and
a sidebar with selectable items. If I doubleclick an item in the main
document it does a calculation on the server and then adds a single
word to the sidebar area.

My question is should I use AJAX to call the server and update the
single word? Or just use a normal web request and refresh the whole
page? Logically it is only one word so less bandwidth to get it via
AJAX. However I have found it makes some of the coding less clean -
e.g.with AJAX I have to generate the HTML table on the server or in
raw javascript; whereas with refreshing the page I can use web2py html
helpers in embedded python in the webpage - much simpler and keeps the
HTML in the view. I cannot see a performance difference with 1 user on
a local server and I guess most of the data hungry items on the page
are cached anyway.

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?

Reply via email to