使用php变量在javascript上传递多个参数
我有以下javascript,它将php站点重新加载到div中:使用php变量在javascript上传递多个参数,php,javascript,variables,parameters,Php,Javascript,Variables,Parameters,我有以下javascript,它将php站点重新加载到div中: if (boxes.length) { $(".loadingItems").fadeIn(300); // Change the name here as well $(".indexMain").load('indexMain.php?'+this.name+'=' + boxes.join("+"), function() {
if (boxes.length) {
$(".loadingItems").fadeIn(300);
// Change the name here as well
$(".indexMain").load('indexMain.php?'+this.name+'=' + boxes.join("+"),
function() {
$(".indexMain").fadeIn('slow');
$(".loadingItems").fadeOut(300);
});
我想在同一url中传递另一个参数
所以我想我应该按照下面的方法来做,尽管我不能让它工作。这条路对吗
我试图使用php变量$category
传递参数categ
,如下所示:
if (boxes.length) {
$(".loadingItems").fadeIn(300);
// Change the name here as well
$(".indexMain").load('indexMain.php?categ=<?php echo $category;?>&'+this.name+'=' + boxes.join("+"),
function() {
$(".indexMain").fadeIn('slow');
$(".loadingItems").fadeOut(300);
});
if(box.length){
$(“.loadingItems”).fadeIn(300);
//在这里也更改名称
$(“.indexMain”).load('indexMain.php?categ=&'+this.name+'='+box.join(“+”),
函数(){
$(“.indexMain”).fadeIn('slow');
美元(“.loadingItems”)。淡出(300);
});
我可以看出这不起作用的两个潜在原因(代码似乎很好…):
.js
文件中,或者html文件的扩展名是.html
而不是.php
看起来不错。请显示渲染的输出好吗