javascript - Trying to set the cookie -


i trying set cookie value using:

 function set_cookie ( cookie_name, cookie_value, lifespan_in_days, valid_domain )  {   var domain_string = valid_domain ? ("; domain=" + valid_domain) : '' ;   document.cookie = cookie_name + "=" + encodeuricomponent( cookie_value ) +"; max-age=" + 60 * 60 * 24 * lifespan_in_days +"; path=/" + domain_string ;   }  

...trying use them in onclick function below:

 function datareview_tasks(inputobj)   {    var info = new ioinfo(inputobj);    var id = info.key(0);    setcookie(<%= this.cookiedatafilekey %>,id,1,"");    var redirect_page = '<%= resolveurl("~/gui/datareviewnew.aspx") %>';     window.location = redirect_page;     } 

but getting error in setcookie() undefined. can please me this, doing right way.

your function called set_cookie, you're calling setcookie.

change:

setcookie(<%= this.cookiedatafilekey %>,id,1,""); 

to:

set_cookie(<%= this.cookiedatafilekey %>,id,1,""); 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -