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);
});
精彩评论