My script is this
function Search(){
var Searchterm = $('#Searchterm').val();
$("#grid-selection").DataTable({ //my table id
"ajax": {
"url": "Premium/Home/Search",
"type": "GET",
"data": Searchterm, //need to send this value to controller
"contentType": "application/json; charset=utf-8",
"datatype": "json"
},
"columns" : [
{ "data": "id", "autoWidth": true },
{ "data": "title", "autoWidth": true },
{ "data": "title", "autoWidth": true }
//{ "data": "Country", "autoWidth": true },
//{ "data": "City", "autoWidth": true },
//{ "data": "PostalCode", "autoWidth": true }
]
});
}
And my controller code is like this
public JsonResult Search(string Searchterm)
{
}
The value of Searchterm
passed to the controller is null
. What is the right way to pass the value to the controller?
Aucun commentaire:
Enregistrer un commentaire