Jump to content

Add more variable in ajax trigger


manalnor

Recommended Posts

Dears,

 

If i've the following ajax code inside php file send.php which should send page id to another file caty.php

 

<script type="text/javascript">
$(document).ready(function(){
function Display_Load()
{
$("#loading").fadeIn(900,0);
$("#loading").html("<img src='bigLoader.gif' />");
}
function Hide_Load()
{
$("#loading").fadeOut('slow');
};
Display_Load();
$("#content").load("caty.php?page=1", Hide_Load());
$("#pagination li").click(function(){
Display_Load();
$(this)
var pageNum = this.id;
$("#content").load("caty.php?page=" + pageNum, Hide_Load());
});
});
</script>

 

and i want to send with the page id an php variables called <?=$linerec[catname]?> where is should be something will call it from database at file send.php

 

so the script java file should be something like this and as you can see i've added this page cat=<?=$linerec[catname]?>&

 

<script type="text/javascript">
$(document).ready(function(){
function Display_Load()
{
$("#loading").fadeIn(900,0);
$("#loading").html("<img src='bigLoader.gif' />");
}
function Hide_Load()
{
$("#loading").fadeOut('slow');
};
Display_Load();
$("#content").load("caty.php?cat=<?=$linerec[catname]?>&page=1", Hide_Load());
$("#pagination li").click(function(){
Display_Load();
$(this)
var pageNum = this.id;
$("#content").load("caty.php?cat=<?=$linerec[catname]?>&page=" + pageNum, Hide_Load());
});
});
</script>

 

Now in file caty.php

 

if($_GET)
{
$page=$_GET['page'];
$zoli=$_GET['cat'];
}

$qry="select * from tools where toolcat='$zoli'";
$result=mysql_query($qry) or die($qry);
if(mysql_num_rows($result)=='0')
{
echo "something";
}else{
while($line=mysql_fetch_array($result)){

echo "something else will goes here";
}} ?> 

 

but not working ! i think there is something wrong inside the java code or inside caty.php file in order to send <?=$linerec[catname]?> from send.php to caty.php !

 

any idea

Link to comment
https://forums.phpfreaks.com/topic/250200-add-more-variable-in-ajax-trigger/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.