このプラグインを追加してみてください-jquery.cookies.jsがすでにページにある必要があり、微調整を使用できると確信していますが、私が行っていた作業には十分でした。
(function ($, document) {
if($.cookie){
$.cookieKey = function(CookieName, KeyName, Value, Options){
var reg = new RegExp("(?:([^=]+)=([^&]*)&?)", "ig"),
match = null,
matches = [];
var cookieVal = $.cookie(CookieName);
while(match = reg.exec(cookieVal)){
if(KeyName.toLowerCase() == match[1].toLowerCase()){
if(Value){ //we are updating, collect all values
matches.push([match[1], Value]);
}
else{
return match[2]; //we are getting, sub key found just return it
}
}
else if(Value){ //we are updating, collect all values
matches.push([match[1], match[2]]);
}
}
if(Value){ //we are updating, update values
updatedValue = "",
sep = "";
for(i=0;i<matches;i++){
updatedValue += sep + matches[i][0] + "=" + matches[i][1];
sep = "&"
}
$.cookie(CookieName, updatedValue, Options);
}
else return null;//we are getting, value not found
}
}
})(jQuery, document);
$.cookieKey("mycookiename", "keyname");//get sub key value
$.cookieKey("mycookiename", "keyname", "value");//set sub key value
$.cookieKey("mycookiename", "keyname", "value", {path: "/"});//set sub key value with cookie options