开发者

jQuery/Ajax to dynamically load a specific id PHP page

I'm relatively new to jQuery/Ajax and I was wondering what would be the best way of loading via jQuery/AJAX a php page with an ID attached to it.

obviously

<?php $id = $_SESSION[id]; ?>
<script>
var pageUrl = new Array(); 
pageUrl[1] = "tab1.html?id=<php echo $id;?>"; 
.....
</script>

makes no sense.

What would be the best way of goin开发者_开发知识库g about this? Thank you!


Use jQuery's $.get command and send parameters with it.

$.get("tab1.html", { id: <?php echo $id; ?> },
  function(data){
    alert("Output goes into the variable data: " + data);
  });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜