I’m trying to pass some values to a new window URL:
function sendInfo() {
var params = new URLSearchParams();
params.append("ozip", publicOzip);
params.append("dzip", publicDzip);
params.append("ocity",ocitystatetext);
params.append("dcity", dcitystatetext);
var url = "/critracker.html?" + params.toString();
location.href = "/critracker.html?";
}
however i am getting a “Uncaught SyntaxError: Unexpected token ‘var’ ” on the second window which contains the code:
function get ()
{
var params = new URLSearchParams(window.location.search),
var ozip = params.get("ozip");
var dzip = params.get("dzip");
var ocity = params.get("ocity");
var dcity = params.get("dcity");
}
The new window does not open with the variables as parameters , does anyone have any tips for sending variables and their values to a new window?