I have searched for 5+ hours on this site and tried every code possible on getting this to work. I found a code on here that does pull info from a text file but it displays it into a box. What im trying to do is for it to be displayed inside the page not inside a popup box and to update every second. Also trying to display more than 1 .txt document in horizontal order if possible. Anyone know how I can alter this so it will display properly?
Currently shows this:
Any help would be appreciated, thanks so much for your help
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery-3.1.1.min.js"></script>
<script src="jquery.min.js"></script>
</head>
<Body>
<p><center>Current Track: <span id="trackinfo">No track information available at this time</span></p></center>
<script>
function radioTitle() {
var url = 'localhost/text.txt';
jQuery.get('http://localhost/text.txt', function(data) {
alert(data);
});
$.ajax({
type: 'GET',
url: url,
dataType: 'text',
success: function(data) {
$("#trackinfo").html(data)
},
error: function(e) {
console.log(e.message);
}
});
}
$(document).ready(function(){
setTimeout(function(){radioTitle();}, 2000);
setInterval(function(){radioTitle();}, 15000);
});
</script>
</body>
</head>
</html>