我使用jquery-plugin保存数据,用户点击:
$(document).ready(function(){
$('a.close').click(function(){
$.cookie.json = true;
var user = $('article.user').html();
var text = $('article.text').html();
var pic = $('img.profilePicture').attr('src');
var data = { user:"user" , text:"text" , pic:"pic" };
$.cookie('the_cookie' , data , {expires: 7, path: "/", domain: "domain.com"})
var lastSeen = $.cookie('the_cookie');
user = lastSeen.user;
text = lastSeen.text;
pic = lastSeen.pic;
$('.last_seen_user').html(user);
$('.last_seen_text').html(text);
$('.last_seen_image_1').attr('src',pic);
});
});
但是数据没有保存,即使我使用" json",任何人都可以帮我解决这个问题?问候!