我在其中一个部分页面中有以下代码块。
想知道是否可以在更改Radio Butto选择时进行Ajax请求。
提前致谢。
@using (Ajax.BeginForm("_QueriesPartial", "Bug",
new AjaxOptions
{
InsertionMode = InsertionMode.Replace,
HttpMethod = "GET",
OnFailure = "searchFailed",
LoadingElementId = "ajax-loader",
UpdateTargetId = "Result",
}))
{
foreach (Query query in @Model.queries) {
<div class="radio">
@Html.RadioButton("UserQuery", query.id, new { onclick = "submitform()" })
@Html.Label(query.name, query.name)
</div>
}
}
答案 0 :(得分:0)
以下适用于我:
@using (Ajax.BeginForm("Action", "Controller", null,
new AjaxOptions
{
HttpMethod = "POST",
OnSuccess = "JavascriptUpdateMethod(data, target)",
Url = Url.Action("ActionAjax", "Controller")
}, new { id = AjaxFormId }))
{
@Html.Hidden("ActionMethodArg", f.Id)
<div class="radiobutton-inline">
@Html.Label("Default", new { style="width: 45px;"})
@Html.RadioButton("name", f.Id, trueorfalse,
new { onchange = "$('#AjaxFormId').trigger('submit');" })
</div>
}