datatable ajax send data values in array

Home / ajax / datatable ajax send data values in array

Question:
i tried using ajax/datable/codeigniter and i want to send my data in post like array data for example (search[‘value’] = searched_key).
function fetch_vtourdata( is_range_search, minPrice = ”, maxPrice = ”, minSurface = ”, maxSurface = ”, minNbRoom = ”, maxNbRoom = ”, searched_key = ”)
{
var dataTable = $(‘#data_tableVtoursList’).DataTable({
"processing": true,
"serverSide": true,
"order": [],
"ajax":{
url: "../../website/userVtourTable",
type: "POST",
data: { ‘user_id’: user_id,
// 1 = name of POST, 2 = values
is_range_search:is_range_search,
minPrice:minPrice,
maxPrice:maxPrice,
minSurface:minSurface,
maxSurface:maxSurface,
minNbRoom:minNbRoom,
maxNbRoom:maxNbRoom,
search[{
‘value’:searched_key
}]
}
},
"columnDefs" : [
{
"target": [0, 3, 4],
"orderable": false,
}
]
});

$(‘#search’).keyup(function(){
dataTable.search($(this).val()).draw();
});
}
enter image description here


Answer:

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *