Hello I am trying to make a script that can paste a part of a html with ajax. I thought this had to be the simplest thing one can do with ajax but now it seams like it might not work at all. [code] var XMLHttpRequestObject = false; var newhtml = null; if (window.XMLHttpRequest) { alert("nonactiveX"); XMLHttpRequestObject = new XMLHttpRequest(); } else if (window.ActiveXObject) { alert("activeX"); XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP"); } if(XMLHttpRequestObject) { alert("sunt aici"); var theURL = "http://localhost/ajax.htm"; alert(theURL); XMLHttpRequestObject.open("GET", theURL); XMLHttpRequestObject.onreadystatechange = function() { if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { alert("sunt aici 1"); newhtml = XMLHttpRequestObject.responseText; document.write(newhtml); } } XMLHttpRequestObject.send(null); } [/code] I want to get a subsitring from the variable newhtml like substring(newhtml,0,whatever) and just load a part of a file well actually the finished script should search newhtml for some tokens but that is besides the point the point is this doesn't work nothing gets written and if I use responseXML instead of responseText i get a blank page printed as if newhtml was empty or something why doesn't it print out the html?