I use this code to refresh a div with the id=\"my\"
:
You could try:
<script type="text/javascript">
function recp() {
setInterval(function()
{
$("<div/>").load(location.href+ ' #my', function(response, status, xhr) {
$("#my").replaceWith(response);
$(this).remove();
});
});
}
</script>
add another div as a container and load content to it, like that.
<script type="text/javascript">
function recp() {
setInterval(function()
{
$("#result").load(location.href+ ' #my');
});
}
</script>
<div id="result">
<div id="my"><?php echo date('a:i:s'); ?></div>
</div>
Alter your code to use $.get() instead of .load()
<script type="text/javascript">
function recp() {
setInterval(function() {
$.get(location.href, function(data){
$('#my').empty().append( $(data).find('#my').children() );
});
});
}
</script>