How to set Array String through JS Post Back to Web Method?

weazle

New Member
How to send array strings with JS post back to Web Method in ASP.NET, code sample is below:\[code\]function service() { var items = $('#jqxTree').jqxTree('getCheckedItems'); // var jsonText = JSON.stringify({ list: items }); myData = http://stackoverflow.com/questions/15744373/{}; 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); }\[/code\]now i am trying with following:\[code\][WebMethod(EnableSession = true)] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public static void ProcessIndexes(List<string> jsonValue) { var serializer = new JavaScriptSerializer(); }\[/code\]
 
Back
Top