将php变量传递给ajax并在另一个PHP页面上获取它

I want pass a variable through AJAX url to another PHP page and get it with:

 $id=$_GET['id'];

This is my link where value is passed for example $id=6.

<a id="pageid" href="ifsc-bank.php?id=<?=$id?>"><img src="images/iconf.png"/> <?=$bank?> </a>

I want to get the value in ifsc-bank.php.

$id=$_GET['id'];

I tried:

pag.ajax({
type: "post",
url: "ifsc-bank.php",
data: {'data':dataString}, 
success: function(ccc)
  {
    pag("#pageid").html(ccc);
  }
});

First thing, you seem to have an incorrect php open tag It is currently:

<?code?>

It should be:

<?php code here ?>

I also think that your ajax call should be more like the following:

$.ajax
({
type: "get",
url: "ifsc-bank.php",
data: {'data':dataString}, 
success: function(ccc)
  {
    $("#pageid").html(ccc);
  }
});

That is if you have not defined jQuery to be pag. Also, if you are trying to find the value of id using "GET", you should add that in your ajax type.

Please do let me know if these suggestions have not fixed the issue. :)

Thank god thank you all down voters I got my answer the problem is on index.php I have few links on clicking. It will pass a variable link.php?id=8 through the url so hear id=8 passing to second page hear link.php displays all records according to the filter query

 $id=$_GET['id'];

 "select * from table_name where id=".$id "limit";

It's showing 10 records because i set limit 10. now the pagination showing

 1 2 3 4 125 Next Last

on clicking Page 2 its not showing anything because its not passing the id=8 to second page because. i solved it by putting $id=$_GET['id']; before HTML start with small change of code it works

<?php if (isset($_GET["id"]))
 {   
     $_SESSION['page']=$_GET["id"];
     $page = $_SESSION['page'];
 } else {
 $page = $_SESSION['page'];
 $tableName = $page."r";  }   ?>

if you not down voted I keep on searching stackoverflow with out trying it

Thank you all