如何在 ASP.NET 中使用 JS post 将数组字符串发送回 Web Method,代码示例如下:
function service() {
            var items = $('#jqxTree').jqxTree('getCheckedItems');
            //  var jsonText = JSON.stringify({ list: items });
            myData = {};
            for (index in items) {
                myData[index] = items[index].label;
            }
            $.ajax({
                type: "POST",
                url: "ServiceConfiguration.aspx/ProcessIndexes",
                data: "{'jsonValue': " + JSON.stringify(myData) + "}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                async: false,
                cache: false,
                success: function (msg) {
                }
            });
            //alert(items);
        }
现在我正在尝试以下操作:
[WebMethod(EnableSession = true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public static void ProcessIndexes(List<string> jsonValue)
        {
            var serializer = new JavaScriptSerializer();
        }