我正在编写一个Google Maps应用程序,它使用jQuery的$ .ajax()向服务器请求数据,以将请求发送到我的ASP.Net MVC控制器。此控件需要一个适用于舒适类型的List。查询字符串应该是什么样的?
我试过
http://localhost:9090/mapamenities?amenityTypes=1,5
http://localhost:9090/mapamenities?amenityTypes=[1,5]
没有运气。
我想要绑定的SearchRquest属性是
public List<int> AmenityTypes { get; set; }
由于 丹尼斯
答案 0 :(得分:8)
尝试?amenityTypes=1&amenityTypes=5
。
答案 1 :(得分:3)
默认的MVC模型绑定器将根据伯爵的答案处理原始集合。如果您需要绑定复杂类型,请查看this project.