i’m trying to set cookie in a $.post request.
My problem is that i want to delete cookie on browser close so i try this:
$.post("cookie.php",{name:name,surname:surname,usn:usn,psw:psw},function(msg){
...
});
cookie.php:
setcookie("code",$name,"/");
// i don’t add expiration time because i read on the web that in this way cookies will be deleted on browser close.
If i don’t add / parameter ( i read ) my cookie are not applied to every path..
but in this way i retrieve this:
Warning: setcookie() expects parameter 3 to be long, string given in ....
how can i fix it?
According to the manual: http://php.net/manual/en/function.setcookie.php