I used a solution in this post
I used this solution on my webpage and it works partially.
Basically I have a table with a link on each row and when I click a link, I retrieve data via AJAX and display this data in another table. All works well when I click the first link but throws a "403 Forbidden" error when I click another link in the table.
<div class="col-lg-4" id="media-sources-view">
<div id="result">
<table class="table table-hover hidden" id="xarticletab">
<tr>
<th>Title</th>
<th>Name</th>
</tr>
</table>
</div>
</div>
<script type="text/javascript">
$('#mashed_row a').click(function () {
var link_id = $(this).attr('link_id');
$.ajax({
type: 'POST',
url: '<?php echo base_url(); ?>main/explode_link',
data: {'<?php echo $this->security->get_csrf_token_name(); ?>' : '<?php echo $this->security->get_csrf_hash(); ?>', link_id},
dataType: 'json',
success : function(data) {
if(data){
var len = data.length;
var txt = "";
if(len > 0){
for(var i=0;i<len;i++){
if(data[i].title){
txt += "<tr><td>"+data[i].title+"</td><td>"+data[i].name+"</td></tr>";
}
}
if(txt != ""){
$("#xarticletab").append(txt).removeClass("hidden");
}
}
}
}
});
return false;
});
</script>