<div id='here'></div>
I am trying to update a specific div inside a div heap. The content of the div is mainly generated by PHP along with data from the MySQL database in addition to many variables sent via XMLHttpRequest.
The idea is to reload / update the div itself and not load the php file or overwrite it with .text or .html . In this case, I cannot use .load('file.php')
What I tried:
<script type='text/javascript'> function updateDiv() { document.getElementById("here").innerHTML = document.getElementById("here").innerHTML ; } </script>
and (for each 3 second update):
$(document).ready(function () { setInterval(function () { $('#here').load('#here')); }, 3000); });
Ideally, I would require something like:
function reloadDIV () {document.getElementById("here").innerHTML.reload} function reloadDIV () {$('#here').load(self)}
so that I can use it in onClick:
<a onclick='reloadDIV ();'>reload div</a>
source share