开发者

jQuery/Ajax to dynamically load a specific id PHP page

开发者 https://www.devze.com 2023-04-12 11:12 出处:网络
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.

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

精彩评论

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