Code:
xhr = new XMLHttpRequest();
xhr.onreadystatechange = function()
{
if(xhr.readyState == 4)
{
document.write(xhr.status);
if(xhr.status == 200)
document.getElementById('uhuh').innerHTML = xhr.responseText;
else
document.getElementById('uhuh').innerHTML =" Error code " + xhr.status;
}
};
xhr.open("GET", 'test.txt', false);
xhr.send(null);
document.write(xhr.responseText);
is what i have so far. the ready state change part is just there. for some reason my status returns 0. so i just added the last bit it. yea i should probably note then when i make pages for testing something out, i use random things like 'uhuh' the above script works for reading the .txt file. now im going to replace the .txt file with a php page to search my sql database, then some javascript and i should be good to go. woo!
and dj i dont understand the mistake being made