views:

116

answers:

2

I have this code.

xmlhttp.open("GET","getuser.php?q="+str,true);

where q="+str

I want to pass a second var how do I do this?

+1  A: 

Append + "&anotherVar=" + anotherString.

Babiker
+2  A: 
xmlhttp.open("GET","getuser.php?q=" + q + "&r=" + r, true);

Note that this will not properly escape your parameters if they contains special characters. You might want to use something like encodeURIComponent(q) instead.

Mark Byers
Thanks, I'll look into encodeURICompinent()
creocare