Wiki : AjaxDesign
Documentation Home :: Categories :: Index :: Recent Changes :: Comments :: Search :: Help :: Login/RegisterHow and where to use Ajax
and where we should not use it.
Basically Ajax can be used where you would like an interaction between your module and the server without reloading the page, for example for an input validation of a form.
Overview
It consists of three processes:
1. An event such as a pressed button calls a javascript program. The javascript itself is in the pnjavascript directory. That javascript program sends a request to the server by (invisibly) calling a web page. That web page is in your module directory and should be called pnajax.php.
2. The pnajax.php code elaborates the request and prepares the return data.
3. Another javascript program - still in the pnjavascript directory, probably in the same file - elaborates the data it receives to display them.
In the example of validating a form, these three steps look as follows:
1. When pressing the send button, the javascript program collects the inputs, prepares a http request and sends it to pnajax.php.
2. The pnajax.php validates the inputs, eventually using the data base, and decides whether the inputs are acceptable or not.
3. Another javascript program receives the verdict of pnajax.php and displays an eventual error or sends the data definitively to the host.
CategoryKnowledgeBase
