我正在使用bootstrap typeahead,我有以下代码:
Script.js
$('#demo7').typeahead({
ajax: {
method: "POST",
dataType: "JSON",
url: '@Url.Action("List", "Partials")',
data: { something: 35 },
triggerLength: 1
},
scrollBar: true,
displayField: 'Name'
});
PartialsController.cs
[HttpPost]
public JsonResult List(string query, string something)
{
try
{
return Json(this.GetList());
}
catch (Exception ex)
{
throw;
}
}
我想知道如何将额外的参数传递给控制器,我尝试在AJAX调用中放置数据:{something:35},但在控制器中,此参数始终为null ...任何传递额外参数的想法? 谢谢!