I'm trying to save certain data into cookies, in such a way that if I jump from one page to another, the data entered should be saved and retrieved back on refresh. I have a link:
<div class="esc-policy">
<a href="#">New Link</a>
</div>
before i fire the click event i need to save the entered the following data fields:
<table class="form">
<tr>
<td class="label">
<label>Name*</label>
<input id="nameInput" type="text" maxlength="100"/>
</td>
<td class="label">
<label>Description</label>
<input id="descriptionInput" type="text" maxlength="200" >
</td>
</tr>
</table>
I have something like this as my js:
if ($.cookie('back_to_url_onPage_referesh')) {
this.name.attr("value", $.cookie('name'));
this.description.attr("value", $.cookie('description'));
}
I'm not sure of how this works though. Can someone please help!!
Thanks in advance...
I am able to save the values in the cookie..however I still dont get how do i retrieve it while jumping back from one url to another. Ex:i have a url: ('#/link/create') where im creating this cookie..onclick of <a href="#">New Link</a>
..i need to navigate to another url '#/new-link/create', enter few form fields on that page and when i hit the Save button- <a href="#" class="btn">Save</a>,
it should take me back to this url: ('#/link/create')..when i navigate between pages, the data is gone ofcourse, how to save that data on the UI side???