post data with ajax.url().load()

post data with ajax.url().load()

mattctmattct Posts: 9Questions: 6Answers: 0

Hi

How should I go about posting additional data across to a php server-side data source with an ajax load method?

I have a set of filters that modify the datatable based on a the selected value of each filter - this uses $_GET.

I need to pass across additional hidden data to the server-side data source using $_POST

    $('#filter').on('change', function(event) {

      $('#dt_basic').DataTable().ajax.url( 'list?' + $(this).serialize() ).load();

    });

Thanks

Answers

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin

    You need to use ajax.data or preXhr to add data to a POST Ajax request for DataTables.

    Allan

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    I'm not too clear on what you're doing, but you can use ajax.data to add data sent to the server.

    Colin

Sign In or Register to comment.