Javascript examples for Language Basics:XMLHttpRequest
Load something after Page load with XMLHttpRequest
<html> <head></head> <body> <div id="demo"> <h2>The XMLHttpRequest Object</h2> <button type="button" onclick="loadDoc()">Change Content</button> </div> <script> function loadDoc() {//from w ww. ja va 2 s . c o m var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("demo").innerHTML = this.responseText; } }; xhttp.open("GET", "/your.php", true); xhttp.send(); } </script> </body> </html>