Creating Categories in Blogger

Tuesday, August 01, 2006

"Ajax" in action

I've been playing for a while with the Ajax stuff. I think I will eventually work out the issue of having the complete categories list from the archives on the main page, but still need more testing.

For the moment, I copy below the Ajax Magic Spelling, and how to parse HTML code. Really impressive.

function getFile(pURL) {
if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=postFileReady;"GET", pURL, true);
} else if (window.ActiveXObject) { //IE
xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
if (xmlhttp) {
xmlhttp.onreadystatechange=postFileReady;'GET', pURL, false);

// function to handle asynchronous call
function postFileReady() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) {

if (window.ActiveXObject){
vXMLDoc = new ActiveXObject("Microsoft.XMLDOM");
vXMLDoc.async = false;
//IE uses the loadXML method when the source document is NOT XML
}else if(document.implementation.createDocument){
//Firefox requires a parser object to read the text
var vParser = new DOMParser();
vXMLDoc = vParser.parseFromString(xmlhttp.responseText, "text/xml");
if(vXMLDoc == null) alert("XML Doc Load Failed");


Post a Comment

<< Home