How do I alter the ajax POST data and requery

How do I alter the ajax POST data and requery

This is an excerpt of the code I'm using to initialize the datatable:

"serverSide": true,
"ajax": {
    'url':'<?= site_url("cp/user/ajax_serverside_users_datatable"); ?>',
    'type':'POST',
    'data':{
        'token': $('#token').val(),
        'filter': $('#type').children("option:selected").val(),
    },
    'dataSrc' : 'data',
},

When the user selects a value in a dropdown, I want to reload the table with the new value in the 'filter' element.

Thanks E.

Answers

  • kthorngrenkthorngren Posts: 20,276Questions: 26Answers: 4,765
    edited August 2019

    You would use ajax.data as a function. This will allow for new values to be used. See the docs for examples.

    Kevin

This discussion has been closed.