我有以下 JavaScript 代码:
var x = ['CFMG','JMFMG','CPMAF'];
var y = $.param({'test':x});
var data = "Operation=xxx&" + y;
$.post(
"xxx.ashx",
data,
function() { ... }
);
铬合金console.log(data)
Operation=xxx&test%5B%5D=4CFMG&test%5B%5D=JMFMG&test%5B%5D=CPMAF
我的 ASP.NET 代码收到了这个:
{Operation=xxx&test%5b%5d=4CFMG&test%5b%5d=JMFMG&test%5b%5d=CPMAF}
[System.Web.HttpValueCollection]: {Operation=xxx&test%5b%5d=4CFMG&test%5b%5d=JMFMG&test%5b%5d=CPMAF}
base {System.Collections.Specialized.NameObjectCollectionBase}: {Operation=xxx&test%5b%5d=4CFMG&test%5b%5d=JMFMG&test%5b%5d=CPMAF}
AllKeys: {Dimensions:[2]}
全键
{Dimensions:[2]}
[0]: "Operation"
[1]: "test[]"
在即时窗口中,如果我输入,?var["Test[]"]
我会得到:
?var["Test[]"]
"4CFMG,JMFMG,CPMAF"
如何将Test[]
值转换为数组?
谢谢!