|
|
|
|
|
- Automatic AJAX
- Programmed AJAX
The AJAX technology is available natively in WEBDEV. What is AJAX and what are its advantages? AJAX (Asynchronous JavaScript and XML) is used to refresh the data modified in an HTML page without having to redisplay the entire page. For example, if some elements in the page displayed (content of the cart, characteristics of a product, list of cities, map, etc.) are modified, only these elements will be refreshed. The server will not have to send the entire page to the user's computer. This technology has several advantages: - fewer requests are made to the server. Therefore, it can support a larger number of simultaneous connections.
- the information that circulates is less bulky.
- the transmission time is shorted.
- the user sees information immediately and without undesired visual effects.
AJAX can be used at two different levels in a WEBDEV website: - Automatic and immediate AJAX: A simple click allows you to benefit from AJAX features. The code remains the same.
- Programmed AJAX: You can use AJAX functions to perform complex processes.
Note: Some older browsers do not support AJAX. AJAXAvailable is used to determine if the current browser supports AJAX technology. If a process that uses AJAX is run on a browser that does not support this technology, the process is run "as if" it did not use AJAX (e.g., the entire page is refreshed). The diagram below presents how AJAX can be used automatically in a WEBDEV website: For example, a Web page contains the different characteristics of a country (capital, currency, flag, location, etc.). The corresponding information is displayed according to the country selected by the user. | | 1 | Internet user's action. In our example, the Web user selects the country in the "Select a country" combo box. | 2 | The request is sent to the server. | 3 | The query is executed and the search for the characteristics of the chosen country starts. | 4 | The result of the request is sent:- without AJAX: The entire page is sent.
- with AJAX: Only the characteristics of the country are sent.
| 5 | The characteristics of the country are displayed:- without AJAX: The entire page is redisplayed.
- with AJAX: Only the controls containing the characteristics of the country are refreshed.
|
The diagram below presents the use of "programmed AJAX" in a WEBDEV website:
| | 1 | Execution of a process on the browser side (AJAXExecute or AJAXExecuteAsynchronous). | 2 | Request to execute a procedure on the server side. | 3 | The procedure is executed on the server. | 4 | The result is generated. The result of the procedure will be expressed as a character string or an XML document. | 5 | The result of the procedure is sent (RESULT). | 6 | Analysis of the procedure result. | 7 | The modified information is displayed. Only the necessary controls are refreshed. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|