我在functions.php
中添加了自定义Cookie:
add_action( 'init', 'setCustomCookie' );
function setCustomCookie()
{
setcookie('custom-cookie', true, time() + (86400 * 21), '/');
}
并且我需要在单击按钮后更改JS中的值:
$ = jQuery;
$(document).ready(function () {
$('#against_more').click(function (evt) {
event.preventDefault();
var myCookie = getCookie("custom-cookie");
// I tried setCookie and etc. nothing was succesfull
})
});
可以这样做吗?