У меня есть Controller
OrderAssignmentRuleSet
со следующим ActionResult
Методом
public ActionResult OrderAssignmentRuleSetEdit(string customerId, string Name= null, List<string> listOfItems = null)
{
}
И ниже мой Javascript
для передачи данных в мой выше controller
метод
$("#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 () {
}
});
Моя проблема - передать два strings
(идентификатор и имя) и один array
(listofItems в виде списка) в controller
, текущий код ничего не возвращает.Пожалуйста, помогите, что не так с этим кодом?