resting
resting

Reputation: 17467

Datatable not passing data parameter in request

I have the following code:

$('#dataTable').dataTable({
    'ajax': {
        'url' : 'getItems',
        'type': 'POST',
        'data': {
            'dbName': $('.dbName-js').val()
        } 

    }

});

But when I looked into the network request, there's no data being sent.
Is there anything I'm missing?

jQuery 1.10.2
Datatables 1.10.0

Upvotes: 0

Views: 1583

Answers (2)

betonunes
betonunes

Reputation: 1

I was having the same problem, but in my case was the version of the datatables.js (1.10.0-dev). Updating to version 1.10.4 fixed for me!

Upvotes: 0

mainguy
mainguy

Reputation: 8331

You also need to tell dataTables to use serversided data:

$('#dataTable').dataTable({
'serverSide':true,
'ajax': {
    'url' : 'getItems',
    'type': 'POST',
    'data': {
        'dbName': $('.dbName-js').val()
    } 

}

});

Upvotes: 3

Related Questions