I have the following code in my jQuery file
var bases = {};
for (var j = 0; j < selectedVariants.length; j++) {
bases[selectedVariants[j].BId] = selectedVariants[j].CId;
}
and i am getting some data in bases dictionary now
and my question here is how do I pass this bases dictionary to controller through ajax call.
I tried the following thing but bases count in the controller is coming as ZERO
$.ajax({
url: $.url('~/TUP/Tflow'),
type: 'POST',
data: { baseDetails: JSON.stringify(bases)},
async: true,
cache: false,
});
Here when I see in my controller ... bases count is coming as ZERO
Please help me on this
Controller :
[HttpPost]
public JsonResult Tflow(JsonFileContentInputs basedetails)
{
//some code
}
and my model :
[ModelBinder(typeof(JsonModelBinder))]
[DataContract]
public class JsonFileContentInputs
{
[JsonProperty(PropertyName = "basedetails")]
[DataMember]
public Dictionary<string, string> basedetails { get; set; }
}