While passing dictionary values from ajax to MVC controller I couldn't get the "value" from the dictionary but "key" value is available. This is what I have tried.
function makeCall() {
var data = {};
data['one'] = [];
data['one'].push("1");
data['one'].push("2");
data['two'] = [];
data['two'].push("1");
data['two'].push("2");
var name = "panelData";
$.ajax({
url: '@Url.Action("AjaxSample", "Home")',
data: { complexObject: data},
//contentType: "application/json; charset=utf-8", //sending type
//dataType: "json", //expected type
success: successFunc,
error: errorFunc
});
}
If I pass Dictionary<int,int> or Dictionary<string,int>
it's working.