function process(){
url = "text.html"
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4){
alert(xhr.responseText)
}
}
xhr.send();
}
Sorry i cant post comments, maybe you can use this.
take a look at this thread: get full html source code of page through ajax request through javascript