The Old Way & The NEW WAY IN AJAX
My Code: AJAX AND GET var xmlhttp; xmlhttp = GetXmlHttpObject(); if(xmlhttp == null){ alert("Boo! Your browser doesn't support AJAX!"); return; } xmlhttp.onreadystatechange = stateChanged; xmlhttp.open("GET", "http://www.google.com", true); xmlhttp.send(null); function stateChanged(){ if(xmlhttp.readyState == 4){ // do something with the response text alert(xmlhttp.responseText); } } function GetXmlHttpObject(){ // IE7+, Firefox, Chrome, Opera, Safari if(window.XMLHttpRequest){ return new XMLHttpRequest(); } //IE5, IE6 if(window.ActiveXObject){ return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } AJAX AND POST var xhr = new XMLHttpRequest(); xhr.open('POST', 'somewhere', true); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr.onload = function () { // do something to response console.log(this.responseText); }; xhr.sen...