How to send form field values through datatables ajax request

How to send form field values through datatables ajax request

HabitatHabitat Posts: 3Questions: 3Answers: 0

Previously I had a search fields page which would send a series of values from a form to another page that displayed a table of results which matched the criteria from the fields page. I implemented datatables on that particular table yet it was displaying around 6000 rows for most queries and was dreadfully slow when sorting/filtering and unfortunately pagination is not an option for me in this case. I decided that I needed to switch to server-side processing, but am at a loss for how I can send my GET values from the result page to my external php/server side processing page using the "ajax": initialization parameter. The url after submitting the form looks like this

'testserver.php?recordnum=&prvdrnum=&prvdrname=&cbsa=&urbanrural=&ownertype=&prvdrstrt=&prvdrcity=&prvdrstate=AR&county=&prvdrzip='

These are the values I'm trying to send in this case.

Here is my datatables init currently

$('#resultTable').dataTable({
    "bProcessing": true,
    "oLanguage": { "sSearch": "Filter All Fields By:" },
    "bLengthChange": false,
    "bPaginate": false,
    "scrollY":        "600px",
        "scrollCollapse": true,
    "bServerSide": true,
    "sAjaxSource": "query.php",
    "sServerMethod": "GET",
    fnDrawCallback : function( oSettings ) {
       $(this).find('tbody tr').each(function(index) {
         $(this).find('td').first(0).text(index+1);
       });
     }
    });

When I check my JSON from the external php page query.php on 'testserver.php' it returns a JSON which just looks like this: []

but I have checked the json by appending the query.php url with my GET form results and the json_encode returns a valid JSON

Is there anything else I would need to do to get query.php to accept the values in the testserver url from my ajax request?

Thanks in advance

This discussion has been closed.