由网友(过去的过不去)分享简介:我如何发送int数组从$就到C#MVC?解决方案 $。阿贾克斯({网址:< URL的作用&gt ;,的键入:POST,数据:JSON.stringify([1,2,3]),数据类型:JSON,的contentType:应用/ JSON的;字符集= UTF-8});和在动作公众的ActionResult R...![引用数据类型 数组 Java基础知识 4](https://p.xsw88.cn/allimgs/daicuo/20230911/2185.png)
我如何发送int数组从$就到C#MVC?
解决方案 $。阿贾克斯({
网址:< URL的作用&gt ;,的
键入:POST,
数据:JSON.stringify([1,2,3]),
数据类型:JSON,
的contentType:应用/ JSON的;字符集= UTF-8
});
和在动作
公众的ActionResult ReceiveIntArray(INT []整数)
{
...
}
MVC会自动解析JSON。
检查出this问题。
![引用数据类型 数组 Java基础知识 4](https://p.xsw88.cn/allimgs/daicuo/20230911/2185.png)
How can I send int array from $.ajax to c# mvc?
解决方案$.ajax({
url: <Url of the action>,
type: "POST",
data: JSON.stringify([1,2,3]),
dataType: "json",
contentType: 'application/json; charset=utf-8'
});
and in the action.
public ActionResult ReceiveIntArray(int[] ints)
{
...
}
mvc should parse the json automatically.
check out this question.
相关推荐
最新文章