All pastes #837617 Raw Edit

Anonymous

public text v1 · immutable
#837617 ·published 2007-12-29 20:35 UTC
rendered paste body
var xmlHttp;
try
{
    xmlHttp = new XMLHttpRequest();
} catch (e) {
    try
    {
        xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try
        {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {
            alert("Your browser does not support AJAX!");
        }
    }
}

function makeAjaxCall(url, callback) {
    
    switch(callback)
    {
        case "notices":
            xmlHttp.onreadystatechange = showNoticeMainFrame;
            break;
    }
    
   
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function showNoticeMainFrame() {
    var HtmlObject = document.getElementById("content");
    if(xmlHttp.readyState == 4) {
                    
        var responseXml = xmlHttp.responseXML.documentElement;
                        
        var root = document.createElement("div");
        root.className = "post";
                        
        var title = document.createElement("h2")
        title.setAttribute("class","title");
        title.innerHTML  = responseXml.getElementsByTagName("title")[0].childNodes[0].nodeValue;
                        
        root.appendChild(title);
                        
        var information = document.createElement("div");
        information.setAttribute("class","entry");
                        
        var text = document.createElement("p");
        text.innerHTML = responseXml.getElementsByTagName("message")[0].childNodes[0].nodeValue;
                        
        information.appendChild(text);
                        
        root.appendChild(information);
        HtmlObject.innerHTML = "";
        HtmlObject.appendChild(root);
    }
}