javascript - GetCookie And SetCookie JS not working -


in asp .net webforms project need pass cookie form 1 form another. code in first page set cookie below:

   function set_cookie(name, value) {          document.cookie = name + '=' + value;      } 

the method work fine , can see cookie set.

in second page, try read cookie problem can't read value. code in of reading value below

 var getcookie = function (c_name) {         var name = c_name + "="         var decodedcookie = decodeuricomponent(document.cookie);         var ca = decodedcookie.split(';');         (var = 0; < ca.length; i++) {             var c = ca[i];             while (c.charat(0) == ' ') {                 c = c.substring(1);             }             if (c.indexof(name) == 0) {                 return c.substring(name.length, c.length);             }         }         return "";     } 

what doing wrong?


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -