0

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?.

1
  • You are missing the + operator after score. What exactly do you expect score'&javavar' to do? You can't just put two operands after each other like this. Btw, the browser tells you what the problem is. Seems like a good moment to learn how to debug JavaScript: developer.mozilla.org/en-US/docs/Debugging_JavaScript Commented Feb 18, 2015 at 20:36

2 Answers 2

1
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.

Sign up to request clarification or add additional context in comments.

1 Comment

That's only part of the issue.
1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.