function getdata(url,id) {
	if (document.getElementById) {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }
  if (x) {
    /* ONLY REQUIRED WHEN 'TRUE' METHOD IS USED FOR x.open()
		x.onreadystatechange = function() {
		  if (x.readyState == 4 && x.status == 200) {
			targetId = document.getElementById(id);
			document.getElementById('dataContainer').innerHTML = x.responseText;
		  }
    } */
    x.open("GET", url, false);
    x.send(null);
	
	targetId = document.getElementById(id);
    document.getElementById('dataContainer').innerHTML = x.responseText;
	
	dataContainerHeight = document.getElementById('dataContainer').offsetHeight;
	readytoPrint(id);
  }
}

function readytoPrint(id) {
		printTargetId = document.getElementById(id);
		printTargetId.style.backgroundColor = '#F7F7F7';
		targetHeight = document.getElementById('dataContainer').offsetHeight;
		setTimeout(function(){ printTargetId.offsetHeight<targetHeight ? readytoPrint(id) : printTargetId.innerHTML = document.getElementById('dataContainer').innerHTML; }, 50);
}