I am trying to pass some variables to another page using javascript at present i am passing a single variable in url the url is looks like this
var PageToSendTo = '../xxxx/xxxx.php?appid=4&score='+score;
In at this script score is a javascript variable it is working fine now i want to pass another variable also along with this script
var java_var;
How i am trying to do is something like this
var PageToSendTo = '../xxxx/xxxxx.php?appid=4&score='+score'&javavar='+java_var;
But it is not working properly what is happening here and how to resolve this?.
var PageToSendTo = '../xxxx/xxxxx.php?appid=4&score='+score+'&javavar='+java_var;
Notice +java_var
in the end of url.
and yes also according to @Felix +
is missing in the url.
You are misusing a variable (java
instead ofjava_var
) and are missing a +
.
This code:
var PageToSendTo = '../xxxx/xxxxx.php?appid=4&score=' + score '&javavar=' + java
. . . should be this:
var PageToSendTo = '../xxxx/xxxxx.php?appid=4&score=' + score + '&javavar=' + java_var