Change Tables Source (sideServer) by Select Selectbox (Liveview)
Change Tables Source (sideServer) by Select Selectbox (Liveview)

I have example table: 'bm_2013', 'bm_2014', 'bm_2015',
This my code selectbox:
<div class="dataTables_length">
<label >Pilih Tahun:</label>
<select id="p_tahun" name="p_tahun">
<option value="2015">2015</option>
<option value="2014">2014</option>
<option value="2013">2013</option>
</select>
</div>
this code script i'm trying:
$( document ).ready(function() {
$('#p_tahun').on("change", function(e){
if($(this).val() == '2015'){
$('#bm').DataTable({
"ajax": {url: '../../conn/filter_bm_2015.php', type: 'POST'},
"processing": true,
"serverSide": true,
});
} else if
($(this).val() == '2014'){
$('#bm').DataTable({
"ajax": {url: '../../conn/filter_bm_2014.php', type: 'POST'},
"processing": true,
"serverSide": true,
});
} else if
($(this).val() == '2013'){
$('#bm').DataTable({
"ajax": {url: '../../conn/filter_bm_2013.php', type: 'POST'},
"processing": true,
"serverSide": true,
});
}
});
});
the Question, how to display data 'bm_2013' into tables, if i select selectbox option '2013', n display data 'bm_2014' if i select option '2014'?
This discussion has been closed.
Answers
my html screenshoot: