try this-
in jquery:-
$(function () {
$.post("@Url.Action("Create", "Role")", RoleDetails(), function (data) {
alert("success");
});
function RoleDetails() {
var role = {
"RoleName": $.trim($('#Name').val()),
"RoleDescription": $.trim($('#Description').val()),
"RightsList": JSON.stringify(RightsSelected())
};
return role;
}
function RightsSelected() {
var selectedRights = [];
$('input[name="cbRight"]:checked').each(function () {
selectedRights.push(this.value);
});
return selectedRights;
}
});
and in c#
public class Role
{
public string RoleName { get; set; }
public string RoleDescription { get; set; }
public string[] RightsList { get; set; }
}
[HttpPost]
public ActionResult Create(Role role)
{
return View();
}