Delete cookie created in PHP using javascript action -


i created cookie in php:

    function set_newuser_cookie() {       if ( !is_admin() && !isset($_cookie['sitename_newvisitor'])) {         setcookie( 'sitename_newvisitor', 1, time()+3600*24*365, cookiepath, cookie_domain, false);       }     }     add_action( 'init', 'set_newuser_cookie'); 

i want delete cookie in javascript file after click event, so:

$('.tbf-main-logo-image').on('click', function() {   document.cookie = 'sitename_newvisitor=;expires=thu, 01-jan-70 00:00:01 gmt;'; }); 

i have been on every stack overflow thread pertaining issue , have tried: adding path cookie, made delete_cookie function, using jquery $.removecookie. nothing seems working. 1 thought perhaps everytime header loading recreating cookie? no, shouldn't because have if statement looking cookie name. help!


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -