ページをリロードせずにデータをチェックするために、BeginForm を使用してサーバーにデータを送信したいと考えています。
アクションのタイプが void の場合、EmptyResult を使用する場合と同じように、空白のページが表示されます。Html.BeginFormでも試してみましたが、同じ結果です。
コードは次のとおりです。
見る:
@using(Ajax.BeginForm("putData", "Home", null, new AjaxOptions {HttpMethod = "POST" }, new { target = "_self" }))
{
@Html.ValidationSummary(false)
<fieldset style="padding-bottom: 0" id="Settings">
<legend>Settings</legend>
....
<td width="180" align="right" class="noborder">
<button type="submit" id="checkButton">Check</button>
</td>
</tr>
</table>
</fieldset>
}
コントローラ:
[HttpPost]
public EmptyResult putData(Settings settings)
{
...some checking and updating the model
return new EmptyResult();
}
皆さんが私を助けてくれることを願っています。