The ajax() function provides basic functionality for making an Ajax request, with some additional features, such as automatically sending values from named input fields and inserting the returned data into a particular target within the DOM (or optionally executing some returned Javascript code).
web2py_component (which is a backward compatible alias for $.web2py.component) is a more sophisticated facility for embedding the output of controller actions within web pages. It is much like a page within a page, with the ability to load new content into the component. In particular, it is possible to trap both links and forms, so when you click a link or submit a form contained within a component, the new content will be loaded within the component (without reloading the rest of the page). Components also include functionality to automatically refresh themselves at a fixed interval.
AnthonyOn Thursday, January 7, 2016 at 8:43:40 AM UTC-5, Ariya Owam-aram wrote:
Hi everyone,
I often use ajax and web2py_component for onclick action (for example) but I never know what is difference between them and how to use them the right way. Can anyone guide me a good example, please?
Thank your
Ariya