如何傳遞參數,在ASP.NET MVC的AjaxOptions
類的OnSuccess
功能?如何將參數傳遞給ASP.NET MVC中的AjaxOptions類的OnSuccess函數?
這裏是我的代碼,但它不工作:
<%= Ajax.ActionLink("Delete",
"Delete",
"MyController",
New With {.id = record.ID},
New AjaxOptions With
{
.Confirm = "Delete record?",
.HttpMethod = "Delete",
.OnSuccess = "updateCount('parameter')"
})
%>
UPDATE
的OnSuccess
屬性設置爲(function(){updateCount('parameter');})
解決我的問題:
<%= Ajax.ActionLink("Delete",
"Delete",
"MyController",
New With {.id = record.ID},
New AjaxOptions With
{
.Confirm = "Delete record?",
.HttpMethod = "Delete",
.OnSuccess = "(function(){updateCount('parameter');})"
})
%>
非常感謝我指向那個鏈接。我之前看過那篇文章,但忽略了其中的一個答案。 – 2010-04-09 14:52:45
@Dave,我如何將生成的錨點傳遞給成功函數?我試過'這個',但它沒有奏效。 – Shimmy 2013-05-09 01:16:21