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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.