So I have a page where I allow the user to view contents from a server log. I want the div to be updated only if the content in the server log has changed. If it is the same as what is there in the div, I do not want any updates.
My jquery code looks like this:
$.get("log.php",{log: $('#log').val()}, function(data)
{
if((data.trim()) && ($("#logdata").html() != data))
{
$("#logdata").html(data);
}
});
So I am fetching the content and showing it only if there is data and the data is fresh. However I noticed the div gets updated if it is any non-empty data. In other words this condition (data.trim()
works fine, but $("#logdata").html() != data)
does not. I am not pasting the log data because there are various logs and the data is fickle, so I do not think it is a data issue.
Furthermore since I am setting the data as .html()
and comparing it as .html()
it should not matter.
Also, I took these two contents and compared in Kdiff, but it says "Files A and B have equal text, but are not binary equal". Does anyone know what it means/how I can fix it?