AJAXLib
What's this?
AJAXLib is a small JavaScript tool that makes working with AJAX applications a little easier.
So, what does it do?
AJAXLib:
- loads the XML document
- removes all the whitespace nodes from the document (optionally)
- calls a specified function when XML document is successfully loaded
Internet Explorer uses it's own Microsoft.XMLHTTP object for fetching XML data, while All Good Browsers use a XMLHttpRequest object. AJAXLib unifies those two, so you don't have to write separate code for them.
Usage
Usage is dead simple.
Just call the loadXMLDoc() function with required parameters (URL to your XML document, function name to call after XML is loaded, remove whitespace - true or false) - for example loadXMLDoc('data.xml', callbackFunction, true).
When XML is loaded, you'll get an resultXML variable in the global scope.
That's it.
Browser compatibility
AJAXLib was tested with:
- Internet Explorer 6, Windows
- Opera 8, Windows
- Firefox 1, Windows
- Mozilla 1.3+, Windows and Mac Os 9
- Safari 1+, Mac Os X
Licence
AJAXLib is licenced under Creative Commons Attribution 2.5 License - which means you can use it (for commercial and non-commercial works), modify it and redistribute it, but you must keep the copyright information in the script.
Useful links
Ajax: A New Approach to Web Applications
Very Dynamic Web Interfaces
Dynamic HTML and XML: The XMLHttpRequest Object
Ajax Mistakes
