Google API and XHR request by Scott Tse on March 30, 2010 Google api: http://code.google.com/apis/ajax/playground/ XHR request: function loadXMLDoc(url) { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari jsonhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 jsonhttp=new ActiveXObject("Microsoft.XMLHTTP"); } jsonhttp.open("GET",url,false); jsonhttp.send(null); document.write("Response from mysql:</br>"); document.write(jsonhttp.responseText); return(JSON.parse(jsonhttp.responseText)); } var result = loadXMLDoc('the_request.php');
Comments