this is my client side code.The server side php code is simply to echo statement.
function load(){if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.xmlhttp");}
if(xmlhttp==null)
{ alert ("Your browser does not support XMLHttpRequest!");
return; }
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.write("Received");
document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
}
};
xmlhttp.open("GET", "http://localhost/tphp.php?", true);/*this works separately*/
xmlhttp.send();document.write("Sent")}
My html code contains
<h4 id="txtHint">to be replaced</h4>
<input type="button" onclick="load()" value="click" />
My PHP code it contains echo statement.i just want to test it
<?php
echo "It's working";
?>