具有2个变量的Ajax数据表+在列中呈现

I have a Datatable plugin working with ajax to load the data. I want get a result in a column based on 2 conditionals. The below code is working good but with just one conditional. I'mnot sue how to add status_token to the equation. I want to add status_token variable the same as status is working.

I've tried status, status_token and { data: {'status': status, 'status_token': status_token}, render: function(status){ but it's not working.

$('#tableEvent').DataTable({
    processing: true,
    serverSide: true,
    ajax: "{!! route('datatables.data') !!}",
    columns: [
{ data: 'status_token', name: 'status_token' },
{ data: 'status', //<-- how can I add another variable status_token?
    render: function(status){ //<-- same here status_token
        if(status == 'hello'){
            return 'aa';

        }else{
            if(status_token == 'bye'){
                return 'bb';

            }else{
                return 'cc';
            } 
        } 
    }
}

As per Rohit.007 suggestion I tried this code

{ data: {'status': 'status', 'status_token': 'status_token'},
    render: function(status, status_token){

But for some reason it's still not working, checking out the variable status_token I get "display" no idea what's that and why it's different from the first column which is returning the correct information.

New whole code:

$('#tableEvent').DataTable({
    processing: true,
    serverSide: true,
    ajax: "{!! route('datatables.data') !!}",
    columns: [

{ data: 'status_token', name: 'status_token' },

{ data: {'status': 'status', 'status_token': 'status_token'},
    render: function(status, status_token){
        if(status == 'hello'){
            return 'aa';

        }else{
            if(status_token == 'bye'){
                return 'bb';

            }else{
                return 'cc';
            } 
        } 
    }
}
],

responsive: true

});

I didn't get you but still, are you looking for a similar thing?

{
  data: {
    'status': false,
    'status_token': 'asdfasdfasdfasdfasdf'
  },
  render: function(status){
    if(status=='hello'){
      return'aa';
    }else{
      if(status_token=='bye'){
        return'bb';
      }else{
        return'cc';
      }
    }
  }
}

Add another parameter in your render function. Then using it get the value of status_token field.

render: function(status, type, row){
        if(status == 'hello'){
            return 'aa';

        }else{
            if(row.status_token == 'bye'){
                return 'bb';

            }else{
                return 'cc';
            } 
        } 
    }

Updated whole code:

$('#tableEvent').DataTable({
  processing: true,
  serverSide: true,
  ajax: "{!! route('datatables.data') !!}",
  columns: [{ data: 'status_token', name: "status_token" },
    { data: 'status': 'status', name: 'status',
      render: function(status, type, row) {
        if (status == 'hello') {
          return 'aa';

        } else {
          if (row.status_token == 'bye') {
            return 'bb';

          } else {
            return 'cc';
          }
        }
      }
    }
  ],
  responsive: true
});

https://datatables.net/reference/option/columns.render

$('#tableEvent').DataTable({
  processing: true,
  serverSide: true,
  ajax: "{!! route('datatables.data') !!}",
  columns: [

    {
      data: 'status_token',
      name: 'status_token'
    },

    {
      data: {
        'status': 'status',
        'status_token': 'status_token'
      },
      render: function(data) {
        if (data.status == 'hello') {
          return 'aa';

        } else {
          if (data.status_token == 'bye') {
            return 'bb';

          } else {
            return 'cc';
          }
        }
      }
    }
  ],

  responsive: true

});

It works for me.

</div>