Reputation: 14950
I have a problem with the cookie I've created.
Related to this question, my cookie is now working. The problem is if I changed the user, the same cookie is still being shown. Are there ways to ensure that the particular cookie is for that particular user? Thank you
Upvotes: 0
Views: 35
Reputation: 7583
It seems that your previous code only triggers cookie creation when it's null
if ($.cookie('cookieCreditDash') == null) {
...
}
So I suggest you just clear the cookie everytime a user-logout event is triggered.
$.removeCookie('cookieCreditDash');
Or, if you can change users without any user logging out, then trigger saveCreditCookie
function everytime you change users. Not sure though how that's detected in your application.
$.getJSON(url, function(data) {
saveCreditCookie(data);
});
Upvotes: 2