The Netlobo logo - a Nevada desert landscape

Making AJAX Easier

Showing the world that AJAX doesn't have to be that complicated

Published Feb 14, 2006 by lobo235
Last updated on Jul 3, 2007

AJAX is an awesome thing but it can be a pain to implement on your website. There are many libraries and functions out there already that can help you get your AJAX done but a lot of them have a bunch of extra stuff that you don't really need all the time. Some of the libraries do not provide any documentation at all for whatever reason. I wanted a simplified AJAX function that was still powerful and easy to use without a lot of extra stuff. I wanted it to be documented to the point that I didn't need to try and decrypt the code to even know how to use it. This is what I came up with.

I took some serious time putting this AJAX function together. I have been using it for a while now and it is solid. I am posting it here for anyone who needs a good AJAX function that does not rely on any huge libraries to work properly. This function uses the innerHTML method to dump the results of the AJAX request into a div or other HTML element without having to parse through XML and manipulate the DOM with javascript to display the data.

I think that this is the way that AJAX should typically be done. I have used many different methods and libraries for AJAX and this is the result of what I liked and did not like about each of them. The following code works in IE 5.5+, Firefox, Safari, Opera, and Konqueror. I have not had a chance to test it with older versions of these browsers but I would assume that any AJAX capable browser should work. Please let me know if you notice any problems with your browser. Feel free to use this wherever you wish, all I ask is that you give credit where credit is due. Simply leaving my name and URL in the comments will be fine.

The AJAX function is downloadable here: netlobo-ajax.js

A working example of the function: Netlobo AJAX Example

0 comments for this article. Be the first to leave one!

Other great Web Development and Programming articles on
Clean URLs using Apache's mod_rewrite
Javascript DOM insertAfter function
Toggle Background Color using Javascript