Omu*_*Omu 7 ajax asp.net-mvc jquery
atm我正在尝试这样,但没有运气,我的Do行动无效
var arr = [31,17,16];
$.get('<%=Url.Action("Do", "Foo") %>',
{ids:arr},
function(d){...});
public ActionResult Do(IEnumerable<int> ids)
{
...
}
Run Code Online (Sandbox Code Playgroud)
试试这样:
$.ajax({
url: '<%= Url.Action("Do", "Foo") %>',
data: { ids: [ 31, 17, 16] },
traditional: true,
success: function(result) {
}
});
Run Code Online (Sandbox Code Playgroud)
注意traditional: true参数.
或者如果你坚持这个$.get()功能:
$.get(
'<%= Url.Action("Do", "Foo") %>',
$.param({ ids: [31, 17, 16] }, true),
function (result) {
}
);
Run Code Online (Sandbox Code Playgroud)