如何将 int 数组从 $.ajax 发送到 c# mvc?
$.ajax({
url: <Url of the action>,
type: "POST",
data: JSON.stringify([1,2,3]),
dataType: "json",
contentType: 'application/json; charset=utf-8'
});
并在行动中。
public ActionResult ReceiveIntArray(int[] ints)
{
...
}
mvc应该自动解析json。
查看这个问题。 https://stackoverflow.com/questions/5525053/passing-array-from-jquery-to-mvc-net-controller-giving-null-result-on-controller
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)