Protoload: Ajax Loading

Ajax, Javascript Add comments

Andreas Kalsch has written a simple library, Protoload, that handles the Ajax loading events that are common place as a way to show users that something is happening on the server, in a particular location:

Protoload

E.g. a faw XHR example:

PLAIN TEXT
JAVASCRIPT:
  1. var R = new XMLHttpRequest();
  2. R.onreadystatechange = function() {
  3.   if (R.readyState == 4) {
  4.     // Do something with R.responseXML/Text …
  5.     $('thirdBox').stopWaiting();
  6.   }
  7. };
  8. R.open(method, uri, true);
  9. $('thirdBox').startWaiting();
  10. R.send(method == 'GET' ? null : query);

[via Ajaxian]

Leave a Reply

Entries RSS Comments RSS Log in