此代码返回我的dict中的键和值
$.map(dict, function (value, key) {
console.log(key, value);
});
输出:
0 ["19,0,0,0", "23,0,0,0", "21,0,0,0", "22,0,0,0", "20,0,0,0"]
1 ["68,0,0,0", "69,0,0,0", "70,0,0,0", "71,0,0,0", "72,0,0,0", "73,0,0,0", "74,0,0,0", "75,0,0,0"]
2 ["115,0,0,0", "114,0,0,0"]
所以,在我看来,这是一个Dictionary <string,string[]>
我想将dict传递给控制器
$.ajax({
url: '/Home/SomeAction',
type: 'GET',
data: { categoryId: categoryId, traitValues: dict }
});
public ActionResult SomeAction(int categoryId, Dictionary<string,string[]> traitValues){...}
这是一个问题。在控制器密钥字典中是可以的(0,1,2)。但价值是空的。
那我怎样才能将我的dict从js传递给控制器?