Accessing localstorage immediately after setItem()
<p>I'm trying to store arrays in localStorage on the clients browser for easy access of the content after the page has loaded, the arrays are pulled from a database. </p>

<p>My problem is that I can only use the local storage once the page has reloaded and it has reflected on the client, similar to this problem <a href="https://stackoverflow.com/questions/3230133/accessing-cookie-immediately-after-setcookie">HERE</a> with cookies.</p>

<p>I can't seem to find a solution to this. Any help would be appreciated
some code: </p>

<pre><code>localStorage.setItem('owner', JSON.stringify(data));    
var seat = JSON.parse(localStorage.getItem('owner'));
</code></pre>