Encode query string in url

Nov 14 2018 3:51 AM
window.btoa(str);   // for encoding any string
window.atob(enc);   // for decoding any encoded string
 
on 1st page, where we pas query string
 
var qstring = "&projectname=" + window.btoa(projectData[t][1].v) + "&account=" + window.btoa(projectData[t][4].v) + "&pcode=" + window.btoa(projectData[t][0].v) + "&ced=" + window.btoa(projectData[t][13].fv) + "&pract=" + window.btoa(projectData[t][9].v) ;
var link = "[site url]" + qstring;
 
on 2nd page, where query string variable is fetched
 
//First we must call the EnsureSetup method
JSRequest.EnsureSetup();
//Get a query string parameter called Id. i.e - "page.aspx?Id=11" will return 11
var account = JSRequest.QueryString["account"];
var projectName = JSRequest.QueryString["projectname"];
var contractEndDate = JSRequest.QueryString["ced"];
var pcode = JSRequest.QueryString["pcode"];
var pract = JSRequest.QueryString["pract"];
var acnt = window.atob(account);
var pName = window.atob(projectName);
var pCode = window.atob(pcode);
var ced = window.atob(contractEndDate);
var practice = window.atob(pract);
 

Answers (1)