Some of the information here may be outdated, please check the book instead

web2py is not an AJAX framework but it works with AJAX frameworks. For examples scriptaculous works great with web2py. You may also use Web2py controllers to handle JSON request/response messages. Web2py also come with some a view called "web2py_ajax.html" included by "layout.html" that provides popup, collapse, fade effects and an "ajax" function that performs can asynchronous web2py connections (see the examples).

fade example

<div id="message">Hello World</div>

make the message "Hello World" appear. Use -0.3 to make it disappear.

ajax example

<form><input id="source"/></form>
<button onclick="ajax('test',['source'],'destination');"/>
<div id="destination">...</div>

When the button is cliched an http request to test?source={value of source} is sent to sever and response is placed in destination tag.

© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by web2py - design derived from a theme by the earlybird
The content of this book is released under the Artistic License 2.0 - Modified content cannot be reproduced.