通过Ajax调用在C#控制器中获取Null值

时间:2016-07-26 17:27:07

标签: c# ajax

function unlockJob(jobrunid, entityId) {
    $.ajax({
        type: "POST",
        url: '/management/redis_locks/' +jobrunid + entityId,
        data: '{' + jobrunid + entityId + '}',
        contentType: "application/json; charset=utf8",
        dateType:"json",
        body: jobrunid,
        success: function () {
            $("#" + jobrunid + "").append("<span style='color:green'>Unlocked Successfully</span>");
            $("#button"+ jobrunid + "").hide();
        }
    });
} 
    //This is Controller method i am calling
[POST("redis_locks/{entity_id}")]
    [AccessLevelAuthorizationFilter(MinimalAccessLevel = AccessLevel.Admin)]
    public JsonResult UnlockJob(String JobrunId, String entityId)
    {
        _redisRepository.ReleaseLock(RedisKeys.JobRunner.GenericEntityLock(entityId, _cacheKeyBuilder.Prefix));
        var model = true;
        return Json(model, JsonRequestBehavior.AllowGet);
    }

这是我调用的Javascript代码和C#代码,当我从上面的ajax函数调用时,我无法在Controller中获取值。!!

0 个答案:

没有答案