load/reload table data on click
load/reload table data on click
crush123
Posts: 417Questions: 126Answers: 18
i have a datatable with an ajax/json source filtered with a url parameter.
next to my table i have a list of parameters from a php recordset source
what i want to do is, on clicking of the parameter (class) name, pass this value into my ajax source and reload the table
$(document).ready(function(){
//on click, load the ajax
$(".list-group-item_<?php echo str_replace('.php','',($rspages->getColumnVal("PageName"))); ?>").click(function(){
var table = $('#example').DataTable();
table
.ajax.url('/ajax/CMS_Content.php?PageName=<?php echo ($rspages->getColumnVal("PageName")); ?>').load();
});
});
the 'click' function is running, but the table data is not being reloaded
test page http://www.hutch.forthwebsolutions.com/admin/content/plugins/cmscontent.php
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Actually - it looks to me like it is reloading the table's data, but if you look at the data returned from the server it is always the same. That is probably because the
PageName
is always being set asgardens.php
.That is happening because you are using
ajax.data
to always add that data parameter.Allan
Thats it.
I think I was expecting my function call to override that setting.
Thanks Allan