1

I saw several questions asked to do this, and it seems like I am just following the same thing that is in the answer but I it seems like there is some error in my code.

function setCookie(cname, cvalue, exdays) {
        var d = new Date();
        d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
        var expires = "expires=" + d.toUTCString();
        var curCookie = cname + "=" + cvalue + "," + expires + ",path=/";
        document.cookie = curCookie
        alert("Your Cookie : " + document.cookie);
    }

I calling this function like this -

 setCookie("upperLimit", upperLimit, 10);

but alert only shows - Your Cookie :

Maybe there is some syntax error, but I am unable to figure it out.

Also, I have checked my settings for cookies and they seem to be as required.

Dhanashree
  • 235
  • 1
  • 3
  • 20

0 Answers0