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

后端 未结 4 1190
不知归路
不知归路 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-18 00:06

    The data you are passing you are trying to pass it as a string already. If you want jQuery to transform it leave the whole thing as an object, e.g.

    data:{backerEntries: backerEntries }
    

    Assuming of course backerEntries is an array. jQuery should transform this and will append it to the querystring as that is its default behaviour. Your current code is relying on default JavaScript behaviour which won't by default convert an array into its string representation.

提交回复
热议问题