irwan

AJAX - Absolute for Beginner

Nov 12th, 2011
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. index.html
  2.  
  3. <html>
  4. <title>Simple Ajax</title>
  5. <head>
  6. <script type="text/javascript">
  7. function loadPage() {
  8. var xmlhttp = new XMLHttpRequest();
  9. xmlhttp.open("GET","display.php",true);
  10. xmlhttp.send();
  11.  
  12. xmlhttp.onreadystatechange = function() {
  13. document.getElementById('display').innerHTML = xmlhttp.responseText;
  14. }
  15. }
  16. </script>
  17. </head>
  18. <body>
  19. <input type="button" value="Display" onClick="javascript:loadPage();" />
  20. <div id="display"></div>
  21. </body>
  22. </html>
  23.  
  24.  
  25.  
  26. display.php
  27.  
  28. <html>
  29. <title>Simple Ajax</title>
  30. <head>
  31. </head>
  32. <body>
  33. <h1>Welcome</h1>
  34. </body>
  35. </html>
Advertisement
Add Comment
Please, Sign In to add comment