I revised the script again but it still does not call the AJAX function printFromHere()???
I would also like to get the response text back in the div "printer_response".
Also, is there a way to get a variable from the php page test_print.php back to the <div>printer_response </div>??
thanks,
echo "<td><div id='printbutton'><input type=\"button\" name=\"print\" value=\"Print this page\" id='printbutton' onClick=\"printFromHere();\"/></div></td>";
echo "</tr>";
echo "<tr>";
echo "<td><div id='printer_response'>";
echo "</form>";
function printFromHere(){
var xhr = document.forms[0].search_zonenm.value;
if ( window.XMLHttpRequest ) {// code for IE7+, Firefox, Chrome, Opera, Safari
xhr=new XMLHttpRequest();
}else{ // code for IE6, IE5
xhr=new ActiveXObject("Microsoft.XMLHTTP");
}
xhr.onreadystatechange = function()
{
if(xhr.readyState == 4)
{
if(xhr.status == 200)
document.getElementById.printer_response="Received:" + xhr.responseText;
else
document.getElementById.printer_response ="Error code " + xhr.status;
}
}
xhr.open(GET, "print_test.php", true);
xhr.send(null);
}
</script>
This is still not resolved I marked it resolved in error.