ColdFusion Consulting
Fast, Scalable, and Data-Driven Web Applications that your business depends on.
ColdFusion Articles

 home > articles >

ColdFusion Documents Introduction to Ajax (Asynchronous JavaScript and XML  May 11, 2007

Ajax (Asynchronous JavaScript and XML) is red-hot and it sweeping the web development community by storm. Ajax can be challenging to pick up and take some trial and error to get you up running. This new web development approach can have dramatic effects on you user interface and improve the user's experience. However, one thing is for sure, if you step back and get the big picture, it can make your first experience with Ajax more pleasant. If you want to be successful at learning to develop Ajax web applications, you will want to be familiar with the following concepts: knowledgeable about the technologies involved, understand what is happening in the background, and using the necessary developer tools.

To implement an Ajax solution you will need to be very familiar with the technologies involved. Ajax uses the following technologies: JavaScript, CSS, XHTML, and XML. Our server-side technology will be ColdFusion in this case. For example, you will use JavaScript to create an XMLHttpObject request object and make a connection to your ColdFusion server. Then the ColdFusion server will return data in the form of an XML document. There are many versions of this code on the internet to handle the XMLHttpObject request object. You have learned what technologies are involved in developing Ajax web applications; let us take you now into the next section about understanding the background processes.

Another critical aspect of using Ajax is to understand what is going on in the background during a request. For example, this could represent one scenario; the user enters data into a form field, which fires the onkeyup function. This is turn calls the JavaScript function to make an XMLHttpObject request that will use the get or post method to call the ColdFusion file on the server. The ColdFusion file will perform the logic needed and then send some data back in XML format. The XMLHttpObject interprets this and the JavaScript function will contain the instructions to update the page via the DOM (document object model). You have now learned about the background process involved with Ajax applications; let us move you into next section where you will learn about one development tool for you Ajax applications.

Finally, using helpful tools to develop Ajax applications will help you be more successful. Firebug is something every Ajax developer will need. This is a plug-in module for the Firefox 2.0 browser. When you run the Firebug extension, on the URL you are working on you will see the requests to URL you are making in the background. This is an invaluable tool because it will send back to you any JavaScript errors that you may have. This tool will dramatically improve your debugging experience and helps you to tackle your bugs. Ajax is one approach that most ColdFusion developers today are looking at using. It can be very challenging at first, but if your patient and stick with it you will see the benefits.

In closing, if you want to be successful at learning to develop Ajax web applications, you will want to be familiar with the following concepts: knowledgeable about the technologies involved, understand what is happening in the background, and using the necessary developer tools.