Why doesn't jquery turn my array into a json string before sending to asp.net web method?

后端 未结 4 1196
不知归路
不知归路 2020-12-17 23:07

So far, I\'ve only been passing javascript strings to my web methods, which get parsed, usually as Guids. but now i have a method that accepts an IList... on the client, i b

4条回答
  •  盖世英雄少女心
    2020-12-17 23:56

    data: "{'backerEntries':" + backerEntries + "}",

    ..is the same as

    data: "{'backerEntries':" + backerEntries.toString() + "}",
    

    ...which is pretty much useless. Use Duncan's suggestion if you just want to pass an encoded list of values with the name "backerEntries" in your querystring. If you want to JSON-encode the data, then get a JSON library and call JSON.stringify().

提交回复
热议问题