I have something like this:
<a href="#" id="lol">LOL</a>
<script type="text/javascript">
$('#lol').click(function(){
$.get("<?php echo $host.'/index.php'?>",
{ page: "topobjekt", index: "<?php echo $l;?>", pages: "<?php echo $pg+1;?>" },
function(data){
$('#primary_content').html(data);
});
});
Is it possible to load specific div(for instance #secondary_content) from my GET requested php page and load it into #primary_content target?
Why not modify your PHP script to handle the AJAX request specifically? You will save wasted bandwidth loading a whole page when you know all you need is one div.
Add a get variable and check for this to determine context.
Change this line:
$('#primary_content').html(data);
To this:
$('#primary_content').html(data.find("#secondary_content"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With