Send parameters using ajax call from jQuery datatables

I want to load data into jquery datatable using ajax. I also want to send the parameters of a function that retrieves data from a database.

So what I want to do:

$('#datatables').dataTable( { "bProcessing": true, "bServerSide": true, "sAjaxSource": "/results/load-results", "fnServerParams": function ( aoData ) { aoData.push( { "quizid": quizid, "questionid": qid } ); } } ); 

I want to send quizid and questionid and use them in my function. How can I pull them into my function? Tried $ _GET, but did not work.

+6
source share
1 answer

Format should be

 "fnServerParams": function ( aoData ) { aoData.push( { "name": "quizid", "value": quizid },{ "name": "questionid", "value": qid } ); }, 
+15
source

Source: https://habr.com/ru/post/954562/


All Articles