how can I pass parameters through DataTable().ajax.reload() using datatable conect
how can I pass parameters through DataTable().ajax.reload() using datatable conect
SandeepMurala
Posts: 48Questions: 13Answers: 0
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi ,
my code is like shown below,
this code will run when i open the test.php at that time I am passing only selectedUser remaining(SelcetedUserArray1,start_dt and end_dt) are empty .
I have one button called
GO
i have written below codewhen i click that Go button i am reloading the datatable ,now in this case iam passing the SelcetedUserArray1,start_dt and end_dt .
Here i am getting the problem bez this datatable() is out of the event so I am unble to pass the "SelcetedUserArray1,start_dt and end_dt ",
Is there any way to pass this paramenter to that datatable .
plz help on it .
Thanks
Sandeep
Use the
ajax.data
option as a function to retrieve the data you want to pass as parameters in the ajax request.Kevin
Hi @kthorngren thank you so much for your reponse ,
I have went through your suggestion ,sorry I did not get you, could you plz explain littile bit more ,in my case how can I procced .I am new to this datatable concept .
Thanks
Sandeep
Here is an example you can look at.
Kevin
@kthorngren ,I went through your suggestion,
In my case I am reloading the datatable when I click the "Go" button by using
$('#quess_table_server').DataTable().ajax.reload();
i am reloading this below code
```
$('#quess_table_server').DataTable( {
"processing": true,
"serverSide": true,
"ajax": "server_selectUser.php?loginUser="+loginUser+"&SelcetedUser="+SelcetedUserArray1+"&start_dt="+start_dt+"&end_dt="+end_dt,
} );
$('#Go_Id').click((funtion(){
SelcetedUser = document.getElementById("selectedUser").value;
start_dt = document.getElementById("start_date").value;
end_dt = document.getElementById("end_date").value;
$('#quess_table_server').DataTable().ajax.reload();
}
```
i am sorry repeat this question ,but i am new to this concept ,i have been trying to undertand the concept plz help me on it and save my day.
Note : problem is when i click the
Go
button i am able to get all this values```` SelcetedUserArray1,start_dt and end_dt ``` in that click event then next line i am reloading the datatable,that datatable out of the event ,so i am unable to sent this variable to datatable({...}) file(server_selectUser.php), I tried making globla variable also but it is showing undified only .How can i solve this problem .
thanks
sandeep
@kthorngren ,
thanks for you valuable time ,
I went through your suggestion ,I am new to this datatable conect so i have been trying to undertand this concept ,
In may case I have button called
GO
when I click this button this below event will triggerin above code you can see I am getting all the values like
then last line i am reloading the datatable which is out of the click event ,that code you can see in below
so in this I am unable to pass those variable bez this datatable is out of the event ,
I trid with GLOBAL variable then It was showing 'undefind'.
So how can i pass this click event variable into datatable ,
Plz help on it and save my day .it so appreciate.
sorry to explain once again .
Thanks
Sandeep
The
ajax.data
docs have some examples. Take a look at the second example which is using a function to get the input values. Sounds like that is what you want to do.Kevin