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