Reputation: 1043
So I created this product called Office. You can create documents. These documents changes are applied and set by form data.
For Example, heres the Document Editor
Form data being, such as the name of the document would be ?docname=My Document
Now, on the home, there is a spot where you can get to documents you have saved. I thought it might be easy to create something where the link to the document is saved in a cookie or some sort of other storage system and then the user can access it on the home
Here is a link to the Home
Someone suggested JQuery Cookies, I am sure I have gotten it set up to save the cookies depending on the naming the link the Document Name, and the value the link to the document, I just need a jQuery or Javascript code to display all of these cookies
On The JQuery Cookies web page on github, it says I can have it where it displays ALL JQuery Cookies that have been written, But the problem is can't specify the cookie name and content because the user writes it. Can anyone show me how to use this? I hope it just displays all cookies.
Upvotes: 0
Views: 8423
Reputation: 440
You may use jquery.cookie.js
then-
var all_cookies = $.cookie();
$.each(all_cookies, function (key, value) {
console.log(key + ':' + value);
});
Its works for me.
Upvotes: 0
Reputation: 122026
you can do
document.cookie.split(/; */).forEach(function(cookieraw){
var cookie = this.split('=');
var name = cookieraw[0];//print it
var value = cookieraw[1]; //print it
});
Upvotes: 1