Reputation: 3515
I want to send user inserted value as parameter inside JQuery data table sAjaxSource property. something like this
var UsersData = $('input[name="UserValue"]').val();
$('#myTable').dataTable({
"bServerSide": true,
"sAjaxSource": "/Home/ProcessThis/UsersData",
"aaSorting": [[1, 'desc']],
...
how to use this UsersData variable inside sAjaxSource, above sAjaxSource example doesnt work.
Upvotes: 1
Views: 1013
Reputation: 82634
Like so I believe:
var UsersData = $('input[name="UserValue"]').val();
$('#myTable').dataTable({
"bServerSide": true,
"sAjaxSource": "/Home/ProcessThis/" + UsersData,
"aaSorting": [[1, 'desc']],
I'm assuming you are used to PHP where you can insert variable name into string, but in JavaScript you have to concatenate.
Upvotes: 1