Ajax Data

Ajax Data

MDNAMDNA Posts: 2Questions: 0Answers: 0
edited March 20 in Free community support
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

  • colincolin Posts: 15,154Questions: 1Answers: 2,587

    On line 27 above, I think you mean to use ajax.data (what's sent to the server), rather than ajax.dataSrc (manipulating what's returned).

    Colin

  • MDNAMDNA Posts: 2Questions: 0Answers: 0

    ahh okaii done, thankss for reply

Sign In or Register to comment.