gpt4 book ai didi

c# - 将 List 从 javascript 传递到 Controller

转载 作者:数据小太阳 更新时间:2023-10-29 05:08:31 25 4
gpt4 key购买 nike

我正在尝试传递 List<int>来 self 的 View到我的Controller .我尝试了多种方法,使用不同的参数。运气不好。

我目前正在尝试通过 {[4,5,13]}到带有参数 List<int> ids 的方法.

发送列表或数字数组的正确格式是什么?

最佳答案

我相信你必须传递这样的东西:

{"ids":[4,5,13]}

如果您使用的是 AJAX,那么我记得我必须将 traditional 设置为 true (See the jquery ajax documentation)这是为了能够正确解析参数。

关于c# - 将 List<int> 从 javascript 传递到 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10218811/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com