Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
Setting up cookies for a newsletter popup

I am trying to set up cookies that expire in 7 days after clicking the 'x' on the modal. I can't figure out why it doesn't want to save the cookie. Below is the code I am using. The site is goodbooks.io.

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"> </script>

<script>
    var cookieName = 'popupClosed';

    if(typeof Cookies.get(cookieName) !== 'undefined') {
        $('.popup-wrapper, .preview-page, .popup-content-wrapper, .popup').remove();
    }

    $('.close-popup').on('click'), function(){
        Cookies.set(cookieName, 'value', { expires: 7});

    }
</script>

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

in PHP

<?php
header('Test 123 I Love Bacon'); // just to test header_ list

setcookie('cookieName','cookieValue123',time()+604800, "example.com");
if(isset($_COOKIE['cookieName']) && $_COOKIE['cookieName'] == 'cookieValue123')
 {
     var_dump(headers_list()); // show headers to be sent to the browser
}
?>

about 4 years ago · Juan Pablo Isaza Report

0

Change

$('.close-popup').on('click'), function(){ ... }

to

$('.close-popup').on('click', function(){ ... })

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!