Trying to retrieve a remote page and include it in the current document. Assume it like, toplist java codes or ad network codes. I dont know Ajax or Java much , going through examples, i model something like the following:

Scenario is calling source.js?id=XX which will output source.php?id=XX
document.write part is wrong i guess, however i dont know how to output response data in Java, anyone to help me?

Code:
var xmlHttpReq = false;
var self = this;
var URL = "http://www.xxxccc.com/source.php";
URL+= "?id="+escape(id);


if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
}
    	
else if (window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject(\"Microsoft.XMLHTTP\");
}

self.xmlHttpReq.open('GET', URL, true);
self.xmlHttpReq.send(null);

if (self.xmlHttpReq.readyState == 4) {
document write (self.xmlHttpReq.responseText);
}