I have the following javascript, which reloads a php site into a div:
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);
});
I would like to pass another parameter in the same url…
So I thought I should just do it as follows, although I cannot get it to work. Is this the right way?
I am trying to pass parameter categ using a php variable $category like this:
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);
});
I can see 2 potential reasons for this not to work (the code seems fine…):
.jsfile or the html file has for example the.htmlextension instead of.php;urlencodeto make sure that does not happen:<?php echo urlencode($category); ?>