I am having problems with XMLHttpRequest loading progressive data. I get state 2, not state 3. After state 3, it is no longer called. What am I doing wrong? I read somewhere that I need to clear the data, but how to do it?
Here is my code:
var xmlHttp = new XMLHttpRequest();
try
{
xmlHttp.open("GET", "http://208.43.121.133:8164/;", true);
xmlHttp.setRequestHeader("Icy-Metadata", "1");
xmlHttp.onreadystatechange = function()
{
alert("status: "+xmlHttp.status);
alert("State: "+xmlHttp.readyState);
if (xmlHttp.readyState == 3)
{
alert(xmlHttp.responseText);
}
};
xmlHttp.send(null);
}
catch (e)
{
alert("Can't connect to server:\n" + e.toString());
}
Am I allowed to read xmlHttp.responseText when readyState is 3?
source
share