if($.cookie('query') === null) {
$.cookie('query','1',{expires:7,path:'/'});
}
@H_
404_2@或者,您可以为此编写一个包装器
函数:
jQuery.lazyCookie = function() {
if(jQuery.cookie(arguments[0]) !== null) return;
jQuery.cookie.apply(this,arguments);
};
@H_
404_2@那么您只需要在客户端
代码中写下:
$.lazyCookie('query',path:'/'});