I have 3 identical HTML pages, same divs and names. On every of these pages I change the content of the divs with jQuery by reading specific values from text files. Unfortunately I have 3 completely identical jQuery files with the only difference that they read from a different text file. What I would like to do is to have one single jQuery file and only one text file. But the problem is that the jQuery would always access the same files on every page.
HTML 1:
<div class="number"><p><span id="number1"></span> </p></div>
<div class="number"><p><span id="number2"></span> </p></div>
<div class="number"><p><span id="number3"></span> </p></div>
<div class="mean"><span id="mean1"></span></div>
<div class="mean"><span id="mean2"></span></div>
<div class="mean"><span id="mean3"></span></div>
HTML 2:
<div class="number"><p><span id="number1"></span> </p></div>
<div class="number"><p><span id="number2"></span> </p></div>
<div class="number"><p><span id="number3"></span> </p></div>
<div class="mean"><span id="mean1"></span></div>
<div class="mean"><span id="mean2"></span></div>
<div class="mean"><span id="mean3"></span></div>
HTML 3:
<div class="number"><p><span id="number1"></span> </p></div>
<div class="number"><p><span id="number2"></span> </p></div>
<div class="number"><p><span id="number3"></span> </p></div>
<div class="mean"><span id="mean1"></span></div>
<div class="mean"><span id="mean2"></span></div>
<div class="mean"><span id="mean3"></span></div>
All three pages completely the same, so the same jQuery can be applies=d.
jQuery:
$('#number1,#number2,#number3').text(function(i){
return table[i][2];
});
$('#mean1,#mean2,#mean3').text(function(i){
return table[i][3];
});
The text file:
1;1;20;3.6;0%;70%;25%;0%;5%;
1;2;80;4;45%;20%;20%;15%;0%;
1;3;80;4;40%;35%;5%;20%;0%;
2;1;20;3.6;0%;70%;25%;0%;5%;
2;2;80;4;45%;20%;20%;15%;0%;
2;3;80;4;40%;35%;5%;20%;0%;
3;1;20;3.6;0%;70%;25%;0%;5%;
3;2;80;4;45%;20%;20%;15%;0%;
3;3;80;4;40%;35%;5%;20%;0%;
So, for example I would like the first HTML page to read from the first three rows, the second from the next three rows. I don't know how to do some delimiter in the text file, or after the first three rows have been used to be deleted. Just don't know how to accomplish it.