Can someone please explain the following code in javascript; it is used to read a text file, but I don't know about the XML and AJAX stuff?
<p>I'm trying to read a text file, and the code that I have completely works. The problem is that I don't understand the code, especially all the <code>onreadystatechange</code> and <code>new XMLHttpRequest();</code> and the <code>status</code> stuff- I am very very confused!!!!</p>

<pre><code>    //load text file, and split each word into an array
function loadwords(myfile){
    var rawFile = new XMLHttpRequest();
    rawFile.open("GET", myfile, false);
    rawFile.onreadystatechange = function ()
    {
        if(rawFile.readyState === 4)
        {
            if(rawFile.status === 200 || rawFile.status == 0)
            {

                //the file is read and stored into a variable
                var Text;
                Text = rawFile.responseText;


                thewords=  Text.split("\n");
                //The variable Text has a string data type.
                //So the string is split into an array.
                //Each line being the form of separation between each element

                var i;
                for (i in thewords){

                    if ( thewords[i] == "") {
                        thewords.splice(i,1);
                    }
                }
                //The for loop checks for any empty spaces in the array.
                //Then removes them from the array using the splice method.
            }
        }
    }
    rawFile.send(null);
    return thewords;
}
</code></pre>

<p>Thank s very much in advance!</p>