Howdy doodee!, need some pointers please
Situation:
I have a text file that is updated one line at a time.
I can change the order of how each line is saved in the text file (i.e inserted at beginning of file or end of text file).
Using text matches if line is a repeat, the line is deleted and inserted with the new line.
So far this works just as it should.
As this text file is updated, each line is displayed on a html page using:
Here is the Javascript:
Problem/Objective:
P: The html page updates with the newest line at the bottom, underneath the previous line. Which causes a scrolling effect going from top to bottom.
O: How do I reverse the order ? As in have the newest line update at the top please ?
Situation:
I have a text file that is updated one line at a time.
I can change the order of how each line is saved in the text file (i.e inserted at beginning of file or end of text file).
Using text matches if line is a repeat, the line is deleted and inserted with the new line.
So far this works just as it should.
As this text file is updated, each line is displayed on a html page using:
HTML:
<div id="showtxt"></div>
JavaScript:
function readText(){
jQuery.ajax({
url : "text.txt",
dataType: "text",
success : function (data) {
var lines = data.split('\n'),
htmlLines = '<p>' + lines.join('</p><p>') + '</p>';
jQuery("#showtxt").html(htmlLines);
setTimeout( readText, 1000 );
}
});
}
jQuery(document).ready(function() {
readText();
});
P: The html page updates with the newest line at the bottom, underneath the previous line. Which causes a scrolling effect going from top to bottom.
O: How do I reverse the order ? As in have the newest line update at the top please ?