Is it possible to update the contents of a DIV? I have a DIV in which I get data present in the browser cookies and I make a foreach for listing the items of the cookies showing them to the user. On that same page I have a button that when I click calls a function adding another item to the cookies, but if I open several tabs of the browser and add other items to the cookies it does not make the updated list of the current page. My intention is that when I click the "Add Items" button it updates the items already listed and shows them to the user. Below the cookie listing code for the user:
<div class="lista">
<?php
$myCookies = $this->getCookie('myCookies');
foreach ($myCookies as $dados):?>
<h3><?php echo $dados ?></h3>
<?php endforeach; ?>
</div>
When I click on the <div class="add-itens" id="mydiv">Adicionar Itens</div>
button I would need a refresh on the lista
div to update the items already in the cookies that have been added in other tabs.
To upgrade via Jquery I tried this, but to no avail.
$("#mydiv").load(location.href + "#mydiv");