December 13, 2005

My first Ajax

Techie

Its been a long time without a blog entry, and now I have a little reason.

My First Ajax


<script>function evalRequest(url) {
     var xmlhttp = new XMLHttpRequest();
     xmlhttp.onreadystatechange = function() {
          if (xmlhttp.readyState==4 && xmlhttp.status==200) {
               eval(xmlhttp.responseText);
          }
     }
     xmlhttp.open("GET", url, true);
     xmlhttp.send(null);
 }
</script>
then a <body onload="evalRequest('http://www.cight.com/hack/hello.js')">

pointing to a file containing

alert ("Hello World")

yes, it doesn't work in IE, but I don't care to start with.

Posted by nickh at December 13, 2005 04:43 PM

Email this entry



Comments