Javascript query string

I have this javascript query string I’m using within
a php script,

$string="getSub('subcat.php?cat='+this.value)";

it works as it is, passing the value of cat,
the challenge is, I want to attach another value, say ‘s=$s’, to the
string(making two now - cat and s), don’t know how to rightly
append this in javascript.

Thanks.

Parameters in a query string are separated by the ampersand symbol (&).

Just add additional parameters (like you added the cat parameter) after cat and separate them with an ampersand.

Tried that before. Didn’t work.

Can you clarify what you’re trying to do versus what’s actually happening? What isn’t working?

I’m not sure how you expect anyone to tell you what you have done wrong if you don’t post your code :slight_smile:

Ok thanks. The code is just what i posted before, i
wanted to add another value to the query string, since
it’s a javascript snippet, using & directly didnt work-i
needed to concatenate the javascript way.

Got it working though:

$string="getSub('subcat.php?cat='+this.value+'&s='+$s)";