I have the following page witch i made based on the following answer: reading server file with javascript but it does not work. And alerts the error. I have the following:
<!DOCTYPE html>
<html>
<head>
<script>
function getFileFromServer(url, doneCallback) {
var xhr;
xhr = new XMLHttpRequest();
xhr.onreadystatechange = handleStateChange;
xhr.open("GET", url, true);
xhr.send();
function handleStateChange() {
if (xhr.readyState === 4) {
doneCallback(xhr.status == 200 ? xhr.responseText : null);
}
}
}
getFileFromServer("http://10.10.10.24/DataInfo.txt", function(text) {
if (text === null) {
// An error occurred
alert("error");
}
else {
alert("good");
alert(text);
// `text` is the file text
}
});
</script>
</head>
<body>
</body>
</html>
Update: My IP address is 10.10.10.24
and can access the link via browser http://10.10.10.24/DataInfo.txt