manalnor Posted November 1, 2011 Share Posted November 1, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/250200-add-more-variable-in-ajax-trigger/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.