my ajax function is triggered on window.load but it doesn't affect html at all. Here's my ajax:
Code:
function titleTopic(url)
{
var xmlhttp;
var txt,txt2,xxx,xx,x;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
x=xmlhttp.responseXML.documentElement.getElementsByTagName("ARTICLE");
xx=x[0].getElementsByTagName("TITLE");
txt=xx[0].firstChild.nodeValue;
xxx=x[0].getElementsByTagName("AUTHOR");
txt2=xxx[0].firstChild.nodeValue;
document.getElementByTagName('h3').innerHTML=txt;
document.getElementByTagName('span').innerHTML=txt2;
}
}
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
Comment