11.04.07

The AJAX XMLHttpRequest Object

Posted in AJAX at 9:21 am by admin

Before you start programming any actual AJAX code, you need to be aware of the fact that AJAX stands for asynchronous JavaScript and XML. This means that rather than being a new coding method for you to use, AJAX is instead a new way of using old coding commands. This means that if you know JavaScript or XML commands, then chances are that you are going to know exactly what to do in terms of commands to use with your AJAX Scripting.

The main problem with JavaScript and XML commands was that for the most part when they were initially unveiled to the world, they had extraordinary redundancies within them. For example, when you filled out a form online five years ago, you were probably amazed at how fast the computer was able to send that information to the person that managed the website. Now, however, you are probably sickened at how slow the process is. This is because the technology has advanced, but the JavaScript functions such as the ones governing forms are stuck firmly in the old world of scripting. They send a single request each time a button is clicked, causing a lower amount of user-friendliness as well as a slowdown in speed that is usually frustrating to the user.

When you are using AJAX, you have a way around it. It is known as the XMLHttpRequest object. This is an object that allows your JavaScript functions to communicate directly with the server your website is hosted on and therefore eliminates all of the problematic redundancies discussed in the previous paragraph.

Before the use of this script, what would happen when you clicked on a form button was that the form request would get sent with a POST data and the page would reload, usually with a thank you message for submitting your request. While that is certainly fine if you don’t mind waiting the extra few seconds, a faster way to do it would be through the use of the XMLHttpRequest. You can easily work this object into your code and instead of reloading the page, the object communicates directly with the server and therefore is able to return you a result without needing to reload the page.

If you want an everyday example of an XMLHttpRequest, then by all means have a look at Google Suggest. When you type into the search box, suggestions are returned to you through Google Suggest. This is, amazingly, done through a JavaScript code that is implanted through AJAX scripting syntax.

Scriptycan is a great software repository featuring both free and commercial Ajax Scripts and applications for both developers and programmers.  

Leave a Comment

You must be logged in to post a comment.