Mahmoud
Mahmoud

Reputation: 31

jquery detecting file change and displaying it

I have a text file that is modified by different python scripts, and I want to create a jquery function that detects each change in that file and to display that change in an initially empty html div

<div id="logtext"> </div>

using

document.getElementById('logtext').innerHTML= new_content_of_the_file;

( something similar to displaying a logfile ) how can I do that?

Upvotes: 0

Views: 119

Answers (3)

alan polar
alan polar

Reputation: 44

You can also use HTML like this:

var content = data_from_python;
$("#logtext").html(content);

The difference between HTML and append() function is that HTML replaces the content of your div. It's the equivalent of innerHTML while append just adds content to the end of an element.

Here is a reference on this topic:
.append()
.html()

Upvotes: 2

Wahyu Kodar
Wahyu Kodar

Reputation: 674

you can use append or html like this:

$("#logtext").append("to do");

Upvotes: 0

David Kmenta
David Kmenta

Reputation: 850

Is this what you are looking for?

$('#logtext').append('<p>' + resultMessage + '</p>');

Upvotes: 0

Related Questions