Jump to content

Need help creating a Cookie


delxy

Recommended Posts

Hi,

i'm not sure this is the right spot for my question ,but i will try. ( sorry if not )

 

I need to create a script, that sets cookie ,named "something" with a random $value - something(1-500) every time the user refreshes his browser.

 

Something like this :

Y.Node.get("#Button1").on("click", function(){

    var newValue = "something" + Math.round(Math.random() * Math.PI * 500);

    Y.Cookie.set("$something", newValue);

    Y.log("Set cookie '$something' to '" + $something + "'");

 

But when i refresh the browser the cookie must be with a new Value.

 

I will explain more clearly :

I hit Button 1,

Activate this script,that sets me the cookie named "something" with a $value for example , something55

I refresh my browser,the same cookie has $value for example something98

 

Thanks in advance,

Regards,

Anton

 

P.S. i'm trying to make it work for a few days .so i will be very glad if someone could help me here .

Link to comment
https://forums.phpfreaks.com/topic/194560-need-help-creating-a-cookie/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.