I'm refreshing a div every 20 seconds on a page. The code refreshes the div but also nests a div inside of itself.
<script>
setInterval(function(){
$("#open").load("test.php #open");
}, 20000);
</script>
Before javascript reload:
<div id="open">
<p>Testing</p>
</div>
After javascript reload:
<div id="open">
<div id="open">
<p>Testing</p>
</div>
</div>
No matter how long the page sites there it will always just have one nested div after the javascript runs. How do I get this to not load another nested div?
.load(test.php #open)and not just.load(test.php)? You're saying to gettest.phpand then take whatever is in#openin that file, and then add it to your current page. That's why you have nesteddivs.