2010年7月11日日曜日

cookie使用準備メモ。

jQueryのcookie.jsでcookie機能を実装しようと思うので、準備メモです。

http://plugins.jquery.com/project/cookie

http://www.stilbuero.de/2006/09/17/cookie-plugin-for-jquery/
http://blog.caraldo.net/2009/03/jqcookiemenu.php

以下が実装方法の引用メモです。(開発元ドキュメントより)
$.cookie('the_cookie'); // get cookie
$.cookie('the_cookie', 'the_value'); // set cookie
$.cookie('the_cookie', 'the_value', { expires: 7 }); // set cookie with an expiration date seven days in the future
$.cookie('the_cookie', '', { expires: -1 }); // delete cookie

ちなみに、cookieの削除は、
$.cookie('the_cookie', null); // delete cookie
でも良くしたということです。
「その方が直感的だから」という要望に応えて。

0 件のコメント:

コメントを投稿