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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.