Ajax technology introduction:
Ajax (asynchronous JavaScript and XML) technology is being increasingly popular in website design. Using ajax technology you can submit form data to the server without refreshing the document. Suppose you are filling an online registration form. You write your user name, email address, address etc. and submit that form. At the server end server detects that the user name has already been taken by another user. So it will generate an error message and request you to choose different user name. Now you have to fill the entire form again unless the server brings your data back to you through query string. Moreover it is not very safe to send your personal information through query string. In such case data submit by ajax technology is the best solution. Another useful feature of ajax technology is that you can send custom data (like user IP) which is not in the form field.
Like conventional data submission ajax data submit also of two types, GET and POST.
There relative merits demerits are same as conventional data submission.How data is submitted using ajax:
1. When user submits data by pressing submit button or by clicking submit link a JavaScript function is called.
2. This function establishes connection with the server by XML HTTP REQUEST object. When connection is established data from the form fields are transmitted to the server.
3. Whenever the server response is received another JavaScript function is fired. This function then takes the necessary steps according to the response text from the server end.
Ajax Advantages and disadvantages:
1. As whole page is not reloaded ajax submission is faster than conventional form submission process.
2. It is more users friendly.
3. Use of ajax technology is not limited to form data submission. It is widely used in dynamic menu design; collecting data for web stat analysis, or even reload the entire page dynamically.
4. Some users disabled JavaScript of their browser. In such cases ajax fails to work.
5. As data are dynamically loaded web history is not available, i.e. you can't reload page by using back button of your browser.