I have a datatable intialised like this:
var _initTable = function() {
$('#datatablesresults tr').not(':first').on('click', function() {
var dateandtime = $(this).find(':nth-child(3)').text();
window.location.href = '/results/detail/dateandtime/' + dateandtime;
});
};
$('#datatablesresults').dataTable({
bProcessing : true,
sProcessing : true,
bServerSide : true,
sAjaxSource : '/results/load-results',
fnServerParams: function ( aoData ) {
aoData.push( {"name": "quizid", "value": quizid },{ "name": "questionid", "value": questionid } );
},
aoColumnDefs : [{'bSortable' : false, 'aTargets' : ['no-sort']}], // make the actions column unsortable
sPaginationType : 'full_numbers',
fnDrawCallback : function(oSettings) {
_initTable();
}
});
When I click on a button I want to reload the data in the table (make an ajax call)
$('.carousel-control.right').click(function() {
var currentquestion = $('#myCarousel .active').index('#myCarousel .item') + 1;
var question = currentquestion + 1;
var quizid = <?= json_encode($quizid); ?>;
var activediv = $('.item').filter('.active');
var questionid = activediv.index() + 2;
var questionclass = ".question" + questionid;
var questionid = $(questionclass).attr("id");
var getParams = "quizid=" + quizid +"&questionid=" + questionid;
$("#datatablesresults").dataTable().fnReloadAjax("/results/load-results?" + getParams);
});
But the data stays the same ... Here you see my ajax calls:

The first is when my page is loaded. The second is my ajax refresh, the data that's resend is different then the other. But then you see there's another ajax call that overwrites the data ... :/
Does anyone knows what I'm doing wrong?
EDIT: I've made a jsfiddle: http://jsfiddle.net/8TwS7/
window.location.hrefreloads the page, could that be it?