Load Page in a Div using Ajax with JQuery in PHP

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  2. <html xmlns="http://www.w3.org/1999/xhtml">  
  3. <head>  
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  5. <title>Test</title>  
  6. <script type="text/javascript">  
  7.     window.onclick = function () {  
  8.         document.getElementById("aside").innerHTML = "<img src='loadingImage.gif'>";  
  9.         if (XMLHttpRequest) var x = new XMLHttpRequest();  
  10.         else var x = new ActiveXObject("Microsoft.XMLHTTP");  
  11.         x.open("GET""other_page.php?aa=1&bb=4&cc=6"true);  
  12.         x.send("");  
  13.         x.onreadystatechange = function () {  
  14.             if (x.readyState == 4) {  
  15.                 if (x.status == 200) document.getElementById("aside").innerHTML = x.responseText;  
  16.                 else document.getElementById("aside").innerHTML = "Error loading document";  
  17.             }  
  18.         }  
  19.     }  
  20. </script>  
  21. </head>  
  22. <body>  
  23. <div id="aside1" onclick="asd()">This is aside</div>  
  24. <div id="aside"></div>  
  25. </body>  
  26. </html>