function click(){ xhttp=new XMLHttpRequest(); xhttp.onreadystatechange=function(){ if (xhttp.readyState==4 && xhttp.status==200) document.getElementById("result") .innerHTML=xhttp.responseText; } xhttp.open("GET","index.php",true); xhttp.send(); }