Ajax Data
Ajax Data
MDNA
Posts: 2Questions: 0Answers: 0
import 'datatables.net';
ngOnInit() {
this.listGA();
}
listGA(){
var url;
if (checkUrl()) {
url = baseUrl + 'Settings/getData';
} else {
url = baseUrlLuar + 'Settings/getData';
}
this.TableGA = $('#ListTableGA').DataTable()
this.TableGA.destroy();
this.ListTableGA = {
destroy: true,
paging: false,
scrollY: "60vh",
scrollX: !0,
scrollCollapse: !0,
dom: 'Bfrtip',
ajax: {
url: baseUrl + 'Settings/getData',
type: 'POST',
dataType: 'JSON',
dataSrc: {
'code': 7,
'param1': '',
},
},
columns: [
{
title: 'Group Access',
data: 'GroupAccess'
}, {
title: 'Description',
data: 'Description',
className: 'dt-body-center'
}, {
title: 'Action',
className: 'dt-body-center'
}],
};
this.TableGA = $('#ListTableGA').DataTable(this.ListTableGA);
}
i have function at angulat(typescript) like this, i want to show data to table with code 7 and param1 from backend Setting/getData. But i still dont get any data, can someone help me please
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Replies
On line 27 above, I think you mean to use
ajax.data
(what's sent to the server), rather thanajax.dataSrc
(manipulating what's returned).Colin
ahh okaii done, thankss for reply