如何将映射js对象传递给控制器​​asp.net mvc5

时间:2018-08-08 11:06:29

标签: javascript asp.net asp.net-mvc-5

我正在尝试将javascript映射对象传递给控制器​​,但是控制器中接收到的内容为空

我的对象

var mymap =new Map();
mymap.set(0,{ "type": '333', "price": '122' ,"limit":0 })
mymap.set(1,{ "type": '222', "price": '333' ,"limit":0 })

ajax通话:

 $.ajax({

                    url: "Index/getKategoryarray",
                    data: JSON.stringify( mymap ), traditional: true,
                    contentType: "application/json  charset=utf-8",
                });

控制器:

public void getKategoryarray( PriceKategory[] pkatg)
        {
        }

PriceKategory类:

public class PriceKategory
    {
        public string type { get; set; }
        public int price { get; set; }
        public int limit { get; set; }
    }

0 个答案:

没有答案