I have a external file with text inside then that is update everytime.
<div id='1'>TEST 1</div>
<div id='2'>TEST 2</div>
<div id='3'>TEST 3</div>
This archive is called IO.HTML
, My Script is getting all the information inside this archive and putting then in only one div, with all the information, I want to separated and update the specific ID every second, with only the text inside it, for example:
$(document).ready(function(){
$.ajaxSetup({ cache: false });
setInterval(function() {
$.get("IO.html", function(result){
$('#1').text(result.trim());
$('#2').text(result.trim());
$('#3').text(result.trim());
});
},1000);
});
html:
<div class="Takt" id="1"></div>
<div class="Takt" id="2"></div>
<div class="Takt" id="3"></div>
But how I say, in the ID 1
, all the information in the archive IO.html
is writing inside then, How can I separated this information with only the text inside the ID?
2
Answers
To load the appropriate content use:
Therefore to load all the three
div
s use:REFERENCE
Wrap the
result
in$()
so you can use jQuery methods to extract the relevant parts of it the same wy you would