我有一个在 AJAX OnSuccess 返回时没有被调用的 java 脚本函数。似乎缺乏文档和示例,因此我正在努力寻找错误的地方。
这是我对 JavaScript 函数的看法,ATM 没有提醒我它正在被调用。我需要向控制器添加逻辑吗?
@model Models.customer
@Scripts.Render("~/bundles/jquery")
<script type="text/javascript">
function OnSuccess() {
alert('Success');
}
</script>
<h2>Delete</h2>
<h3>Are you sure you want to delete this?</h3>
@using (Ajax.BeginForm("Delete", "Customer", new AjaxOptions {OnSuccess="OnSuccess" }))
{
<fieldset>
<legend>customer</legend>
@Html.DisplayForModel()
</fieldset>
<p>
<input type="submit" value="Delete"/>
@Html.ActionLink("Back to List", "Index", new { conName = ViewBag.connectionName }, null)
</p>
}