【发布时间】:2014-08-01 18:30:12
【问题描述】:
我正在尝试将选定的多选列表的选定值发送到我的控制器中的操作。当我打印到控制台时,我已经验证 val() 确实显示了一个选定值的数组,例如 ["33","175"],但 Action 的参数始终为空。我尝试将参数类型更改为对象并验证它不为空,但我无法解析这些值。有什么建议?请和谢谢!
Ajax 调用:
$(".chosen-select").on("change", function (event, params) {
console.log($(".chosen-select").val());
$.ajax({
url: '@Url.Action("BDOReferralSourcesTableHTML","ReferralNetwork")',
type: 'GET',
dataType: 'json',
cache: false,
data: { bdoIds: $(".chosen-select").val() },
success: function (response) {
if (response.length > 0) {
alert(response);
}
else {
alert("response length zero");
}
}
});
});
控制器动作:
public ActionResult BDOReferralSourcesTableHTML(string[] bdoIds)
{
return Content("<b>test</b>", "text/html");
}
【问题讨论】:
标签: c# jquery ajax asp.net-mvc jquery-chosen