JavaScript in the Browser

Asynchronous Response

var request = HTTP.newRequest();

//Register event handler
request.onreadystatechange = function() {
   if (request.readyState == 4) { //if request is finished
      if (request.status == 200) // if it was successful
       alert(request.responseText);
   }
}

request.open("GET", url);

request.send(null);

José M. Vidal .

61 of 66