控制器值从MVC中的Ajax调用获取更新请求的空对象

时间:2019-03-30 14:04:43

标签: ajax object model-view-controller

当ajax请求控制器更新实体时,我可以在ajax中看到列表值。但是当它碰到控制器时,同一对象将变为空。

$.ajax({
            traditional: true,
            async: true,
            type: 'PUT',
            headers: { 'X-CSRF-TOKEN': $("input[name='__RequestVerificationToken']").val() },
            url: "/AccessLevel/ModifyAccessLevelFeatureMapping",
            dataType: 'json',
            contentType: 'application/json',
            data: JSON.stringify(accessLevelFeatureList),
            processData: false,
            cache: false,
            success: function (data)
            { 
            }

控制器>>

[HttpPut]
    [ExcludeFromCodeCoverage]
    public async Task<JsonResult> ModifyAccessLevelFeatureMapping([FromBody]IEnumerable<FeatureMasterModel> featureModel)  --null  value!!
    {
        try
        {
            var accessLevelFeatures = await accessLevelService.UpdateAccessLevelFeature(featureModel);
            return Json(new { accessLevelFeatures });
        }
     }

0 个答案:

没有答案