我有2个PHP变量:$category1
和$category2
我希望网址如下:
?category1=$category1&category2=$category2&q=str
我只知道PHP,我对JS / Jquery的了解很少,有人可以帮我解决这个小问题吗?
我试过了:
var category1 = '<?php echo $category1; ?>';
var category2 = '<?php echo $category2; ?>';
但是,idk在这里写什么
xmlhttp.open("GET","getuser.php?q="+str,true);
答案 0 :(得分:0)
试试这个
xmlhttp.open("GET","getuser.php?q="+ str +"&category1="+ category1 +"&category2=" +category2+,true);
答案 1 :(得分:0)
var category1 = '<?php echo $category1; ?>';
var category2 = '<?php echo $category2; ?>';
var url = "category1="+category1+"&category2="+category2+"&q=str";
xmlhttp.open("GET","getuser.php?"+url,true);
您将像提到的那样获得您的网址
答案 2 :(得分:0)
尝试:
xmlhttp.open("GET","getuser.php?q=" + str + "&category1=" + category1 + "&category2=" + category2,true);
使用+连接字符串