开发者

Will the Sharp Architecture ModelBinder properly constitute an object using a jQuery ajax request?

Do you know if it's possible to make an AJAX request and have the model binder properly constitute an object based on the parameter provided?

For example:

$.ajax({
    开发者_如何学Gotype: 'POST',
    url: '../Create',
    data: ( {
        'SkillTypeRequest.Id':                0,
        'SkillTypeRequest.Event.Id':        eventId,
        'SkillTypeRequest.SkillType.Id':    skillTypeId,
        'SkillTypeRequest.Division.Id':     divisionId
    } ),
    success: function (data) { addSkillTypeRow( data ); }
});

The test controller action is:

public ActionResult Create(SkillTypeRequest request) { return Json( request ); }

At the moment, this fails in the model binder because it's trying to assign null to the SkillTypeRequest.Id. Before I investigate further, just want to make sure this is even possible to begin with or does Sharp/MVC only allow this type of binding through forms?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜