Posts

Showing posts with the label asp.net-ajax

Passing .NET objects to method with AJAX

Image
Clash Royale CLAN TAG #URR8PPP Passing .NET objects to method with AJAX I'm calling a method in my C# code that takes 2 ListBox objects and a GridView as parameters. How do I pass these, what I've tried throws an error saying the parameters are missing. var visList = document.getElementById("<%= shown_ListBox.ClientID%>"); var hidList = document.getElementById("<%= hidden_ListBox.ClientID%>"); var gv = document.getElementById("<%= hm_GridView.ClientID%>") $.ajax({ type: "POST", url: "heatmap.aspx/manageCol", data: JSON.stringify({visList, hidList, gv}), contentType: "application/json; charset=utf-8", dataType: "json", success: function (res) { alert("success"); }, error: function (res, msg, code) { ...