I am trying to get new content from database with php, here is the code:
<?php
if($row['permalink'] == $_GET['contents']){
?>
<section id="workproject">
<div id="one">
<h1><?php echo $row['title']; ?></h1>
<img style="" src="portfolio/<?php echo $row['first_img']; ?>.jpg">
</div>
</section>
<?php
}
}
?>
So that works fine. So if I click on <a href="?content=something"> then that would change the above content. However, I am try to figure hour how to get the result with jquery so that I do not have to reload the page.
I have managed to come this far:
$("#thums").click(function(){
$.ajax({ url: 'index.php',
data: {permalink: 'listaker'},
type: 'get',
success: function(output) {
$('#workproject').html(output);
}
});
});
But this loads the entire page from the start. is there a way that I can only reload the workproject id only. Or any other way to get this to work
Thanks
Try this
instead of your $.ajax() code