filtering data input select
filtering data input select
alderhernandez
Posts: 33Questions: 11Answers: 1
Hi I need to load the table with new data, filtered by a select.
I want to filter data in the table whenever i select an id in a select i have this code but dosnt works
//Script for getting the dynamic values from database using jQuery and AJAX
$(document).ready(function() {
$('#sc_get').change(function() {
var form_data = {
name: $('#sc_get').val()
};
$.ajax({
url: "<?php echo base_url('index.php/ajax');?>",
type: 'POST',
dataType: 'json',
data: form_data,
success: function(msg)
{
var tblBody = document.getElementsByTagName("tbody");
var row = document.createElement("tr");
$.each(msg, function(key, val)
{
var cell = document.createElement("td");
var cellText = document.createTextNode("cell in row ");
cell.appendChild(cellText);
row.appendChild(cell);
});
tblBody.appendChild(row);
}
});
});
});
This discussion has been closed.
Answers
Hi I need to load the table with new data, filtered by a select.