我的行动中有以下内容
[AjaxException]
public ActionResult DoSomething(sring someParam1, string someParam2) {
//do whatever you need to do here, db etc
return new EmptyResult();
}
在我的 html
<form id="search-frm" name="search-frm" action="@Url.Action("DoSomething", "MyActions")" method="post" >
<input type="button" id="search-btn" value="search" class="btn" onclick="DoSomething();return false;" />
<input type="text" name="param1" id="param1" />
<input type="text" name="param2" id="param2" />
</form>
在我的 JS
function DoSomething() {
$("#search-frm").submit();
return false;
}
当我单击按钮时,在控制器操作DoSomething
完成后,我被重定向到MyActions/DoSomething
. 有没有办法不使用 jquery $.ajax
?我只需要做一些事情,而不是离开现有的页面。
谢谢你。