ajax を使用して新しいデータでパーシャルを更新しようとしています。私はjavascriptでこの関数を使用しました:
function replace{
$.ajax({
url: '@Url.Action("DoThing", "Controller"),
type: "POST",
datatype: "actionresult",
async: false,
data: {itemCode: $("#ComboBox-input").val(), unitCode: @(Model.UnitCode)}
});
}
そしてコントローラーのアクション:
Public ActionResult DoThing(int itemCode, int unitCode)
{
var aThing = new ExModel
{
ItemCode = itemCode,
UnitCode = unitCode
}
return PartialView("_InPartial", aThing);
}
デバッグ中に、送信したデータを使用してコントローラー アクションに到達しましたが、返されたデータを使用して部分ビューをレンダリングする方法がわかりません。