AJAX: Asynchronous JavaScript And XML

AJAX is way to program a web page to work faster and smarter by sending data while you're reading the page, without having to reload.

Examples

  • When you see a slideshow of photos, the next photo appears automatically
  • When you choose one item in a form, the web page makes other items appear
  • When you type in a search box, the web page suggestions auto-completions
  • When you change data, the web page downloads a new data chart

Sample

  var xmlHttp= new XMLHttpRequest(); // AJAX in newer browsers
  xmlHttp.onreadystatechange = function() {
    if (xmlHttp.readyState == 4) {
      try {
        if (xmlHttp.status == 200) {
          document.getElementById("ajax").innerHTML = xmlHttp.responseText;
        }
      }
      catch (e) {
        document.getElementById("ajax").innerHTML = "Error " + e.description;
      }
    }
  }
  xmlHttp.open("get","test.html"); 
  xmlHttp.send(null); 

Comments?

Do you have a comment, question, feedback or idea?
Click here to email us!



WebGet Consulting • http://webget.com • Copyright © 2008 • All Rights Reserved
Bookmark and Share