I have Controller OrderAssignmentRuleSet with following ActionResult Method
public ActionResult OrderAssignmentRuleSetEdit(string customerId, string Name= null, List<string> listOfItems = null)
{
}
And below is my Javascript to pass data to my above controller method
$("#rolesValues").change(function () {
var id ='0001'
var name = 'admin'
var listOfItems= [];
//Populating listofItems with multiselect dropdown
if ($('#ddlItemsList option:selected').length > 0) {
listOfItems = $.map($('#ddlItemsList option:selected'), function (item) {
return item.value;
});
}
var data = {
customerId: id,
Name: name,
listOfItems: listOfItems
}
$.ajax({
type: 'POST',
url: '/OrderAssignmentRuleSet/OrderAssignmentRuleSetEdit',
traditional : true,
data: data,
content: "application/json;",
dataType: "json",
success: function () {
}
});
My problem is to pass two strings (id and name) and one array (listofItems as a list) to controller, Current code doesn't return anything. Please help whats wrong with this code?