I am not sure why this is happening. I have a string array that needs to be sent to a controller action that expects a string array. This is my jQuery:
$.post("/@Model.Controller/@Model.Action", { "choices": ajax }, function (result) {
$("#label" + "@Model.Id").html(result);
});
This is my controller action:
public JsonResult UpdateMultipleType(string[] choices)
{
return Json(choices);
}
I looked at Firebug and the Post tab, the headers read:
Parametersapplication/x-www-form-urlencoded
choices[] Comedy
choices[] Thriller
choices[] Action
choices[] Adventure
I debugged and confirmed that it clicks UpdateMultipleType and that the "selection" of the string array is null when this action is called. The call passes, but since we return null, I get a Javascript error after the call ends.
I do not know why my controller action is sent null when it clears, that there is an array that is called when it is sent.
source
share