Where to start to use Ajax?


I would like to use Ajax for dynamic pages that load data from the server, then it is necessary that I learned to use Ajax. But where to start?

Short answer

In order to create a Ajax application it is required:
- To know how to program in JavaScript.
- To understand the principles of asynchronous in order not to be surprised.
- Knowing the properties and methods of the XMLHttpRequest object.
With a basic knonledge of JavaScript, all that can be obtained by using an Ajax tutorial.
In addition some tools to help programming in the best conditions.

Long answer


For editing, Netbeans is a general purpose IDE that has an Ajax mode and that supports server side programming languages.

For debugging, the Firebug extension for Firefox, allowing to see the content of exchanges between the browser and the server, and also due to its error messages, is an indispensable assistant.

Programming and asynchronous

This type of programming marks a break with the procedural logic. The order of instructions execution is no longer the order in the program. Instructions that follow the send() command of the XHR object, can be executed before send has produced a result.
To be sure that an instruction is executed after the conclusion of a request to the server, it must be incorporated into the function assigned to the event handler, which is shown as examples in the tutorial.

Ajax tutorial

Its purpose is to show how to use the XMLHttpRequest object in an HTML page with JavaScript code.
It explains the difference between GET and POST methods of HTTP, and the use of text or XML files.

A basic knowledge of JavaScript is preliminary and methods of DOM too, which is essential to change the contents of an HTML page.

If you want to go beyond the reading of data on the server and interact with a script, passing parameters or not,you must go beyond Ajax itself and integrate the use of a server side programming language. PHP is the most used and an Ajax and PHP tutorial gives the basis for interaction among HTML, JavaScript and PHP scripts.

More infos
© 2009-2012 Xul.fr