javascript - Key Value pair for cookies -
i having image icon on clicking should navigate other page
' <input type="image" id="datareview_' + templates[i].datafilekey + '" title="data review" src="images/datareview.png" style="height: 15px; width: 15px" onclick="datareview_tasks(this); return false;"/>\n' +
in datareview_tasks() function below
function datareview_tasks(inputob) { var info = new ioinfo(inputobj); var id = info.key(0); var tdlastdateid = "lastrun_" + id; var decoded_lastrundate = decodeuricomponent(trim($("#" + tdlastdateid).text())).split(" ")[0]; var lastrundate = encodeuricomponent(decoded_lastrundate); window.location('<%= resolveurl("~/gui/datareviewnew.aspx") %>');
i should making id , lastrundate cookies. how can approach this.
i not sure why not holding value 54 while debugging, new javascript , not sure if giving them in document.cookie appreciated
i should making id , lastrundate cookies. how can approach this.
function datareview_tasks(inputob){ var info = new ioinfo(inputobj); var id = info.key(0); var tdlastdateid = "lastrun_" + id; var decoded_lastrundate = decodeuricomponent(trim($("#" + tdlastdateid).text())).split(" ")[0]; var lastrundate = encodeuricomponent(decoded_lastrundate); var tcookiename = '<%= this.cookiedatafilekey %>'; //this '$datafilekey' placeholder codebehind var tcookievalue = {id: id, lastrundate: lastrundate}; //since there 2 values, passing object. //setting actual cookie document.cookie = [tcookiename, json.stringify(tcookievalue)].join('='); window.location('<%= resolveurl("~/gui/datareviewnew.aspx") %>') } function readcookie(n){ var tc = document.cookie || ''; ts = tc.split(n + '=').pop().split(';')[0]; return json.parse(ts) } readcookie('$datafilekey')
addition
yes, of course values can set seperately:
//settings '$datafilekey' document.cookie = ['<%= this.cookiedatafilekey %>', id].join('='); //settings '$datawhatever' document.cookie = ['<%= this.cookiedatecompleteend %>', lastdaterun].join('='); function readcookie(n){ return (document.cookie || '').split(n + '=').pop().split(';')[0] } readcookie('$datafilekey')
Comments
Post a Comment