【发布时间】:2013-05-11 22:15:59
【问题描述】:
我在表单上使用 MVC4 Ajax 辅助函数,我想从脚本提交表单。
问题是当我调用提交函数时,它没有加载到正确的 div 中。有什么想法吗?
@using (Ajax.BeginForm("NewGame", "Home", new AjaxOptions { HttpMethod = "Post", UpdateTargetId = "targetDiv" }, new { id = "newGameForm" }))
{
<input type="hidden" name="client_seed" id="client_seed" />
<input type="submit" value="New Game" id="NewGameButton" />
<a class=button onclick="$('#newGameForm').submit();">New Game</a>
}
单击标准提交按钮将调用结果加载到 targetDiv。单击锚点会替换当前的 div。
【问题讨论】: