c# - Return view with ViewModel after ajax call -
i call action ajax function, viewmodel in , try open new view other viewmodel redirecttoaction , return view aren't working. other answers saw got opening other view without sending viewmodel it
ajax call
$("#delete").click(function () { var model = $("#forma").serialize(); console.log("delete", model); $.ajax({ url: '@url.action("deletedevices", "package")', contenttype: 'application/json; charset=utf-8', datatype: "json", data: model, success: function (result) { } }); return false; });
and contorller nothing
public actionresult deletedevices(packagedevicesviewmodel viewmodel) { //model processing here return view(newmodel); }
change
data: model,
to data: json.parse(json.stringify($("form").serializearray()))
Comments
Post a Comment