I am trying to read a text file over and over again, and then change the page based on the text. the way I am currently reading the files is taking to long, and I am asking if there is a faster way of doing it.
<script>
scoreIsShown = false
team1 = ""
team2 = ""
score1 = 0
score2 = 0
function UrlExists(url)
{
$.get( "showscore.txt", function(data) {
$(".result").html(data);
showscore = (data.toLowerCase() == "true")
});
$.get( "team1.txt", function(data) {
`enter code here`$(".result").html(data);
//(data);
team1 = data
});
$.get( "team2.txt", function(data) {
$(".result").html(data);
//(data);
team2 = data
});
$.get( "score1.txt", function(data) {
$(".result").html(data);
//(data);
s = (data.toLowerCase() == "true")
score2 = parseInt(data)
});
$.get( "score2.txt", function(data) {
$(".result").html(data);
//(data);
score2 = parseInt(data)
});
}
function showScore1()
{
x = document.createElement("table")
tr = document.createElement("tr")
td = document.createElement("td")
team1p = document.createTextNode(team1)
td.appendChild(team1p)
tr.appendChild(td)
x.appendChild(tr)
document.body.appendChild(x)
}
function onload()
{
while (true){
UrlExists("binary1.txt")
setTimeout(function()
{
if (showscore)
{
if (!scoreIsShown)
{
showScore1()
}
}else{
if (scoreIsShown)
{
//hideScore()
}
}
}, 10)
}
}
</script>
all files are one line long and less than 10 characters each.