你好朋友, 我在更新数据表时遇到问题。 我使用过简单的数据表但现在我必须自定义Code.I有要求,例如选择下拉值数据应该更新,删除旧内容并添加新内容。
function show_by_list(){
var e = document.getElementById("list_name");
var strUser = e.options[e.selectedIndex].text;
var action = 'advance_search_url';
var Data_var = $(this).serialize()+'&prj_id='+strUser;
var select_row_arr='id,url,company_name,phone,firstname,lastname,title,emp_email,visits_per_month,address,city,state,zip,industry,hash_of_product,alexa,quantcast,country,email,note,address1,revenue,rev_range,emp,emp_range';
var table_name = 'crm_contacts';
var index_col = 'id';
var url_var = "<?php echo SITE_URL?>/includes/data_processing_crm.php?table_name="+table_name+"&select_row_arr="+select_row_arr+"&index_col="+index_col+"&flag="+status+"&tab_id="+tab_id;
$.ajax({
type:"GET",
url:url_var,
data:Data_var,
cache:false,
dataType:'json',
success: function (response) {
$('#data_table_id').html('<table id="table-output" class="display" cellspacing="0" width="100%"></table>');
table_config.columns = response.columns;
var table = $('#table-output').DataTable(table_config);
table.clear();
table.rows.add(response.data);
table.draw();
}
});
}
Ajax请求页面是:data_processing_crm.php [这里我得到Json Response如:
aaData [
["3", "http://www.hcgweightdrops.com", "HCG weight drops", 22 more...],
["4", "http://www.jenis.com", "Jeni's Splendid Ice Cream", 22 more...]
]
iTotalDisplayRecords:"2"
iTotalRecords "2"
sEcho "1"]
我的问题是我要在aaData信息之上 怎么做才能帮助我?