Skip to main content

Posts

Showing posts from May, 2018

save cookies with javascript and jquery cookie

<script type="text/javascript"> function setCookie(cname,cvalue,exdays) {     var d = new Date();     d.setTime(d.getTime() + (exdays*24*60*60*1000));     var expires = "expires=" + d.toGMTString();     document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } jQuery(document).ready(function ($) {     $(".close").click(function () {         var text = $(this).attr('value');         setCookie("username7877", text, 30);         $("#note-ticker").hide();     }); }); </script> PHP////////// <?php $cookie_name = "user"; $cookie_value = "Alex Porter"; setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); ?>