2
我知道存在Ajax.ActionLink功能,其签名是这样的:如何用回调javascript函数创建自定义html助手?
@Ajax.ActionLink(
"click me",
"SomeAction",
"SomeController",
new AjaxOptions {
HttpMethod = "POST",
OnSuccess = "success"
}
)
,我可以附加我的回调,例如:
function success(data) {
var json = $.parseJSON(data.responseText);
alert(json.someProperty);
}
我知道HTML辅助的扩展方法。问题:如何创建像Ajax.ActionLink这样的自定义html助手,我可以在其中指定回调函数。谁可以给我举例说明如何使该扩展方法能够将回调函数作为参数并执行它。
什么错以上?看起来很清楚 – dove
你想要自定义扩展方法做什么? –
@Darin Dimitrov - html helper应该是自定义的时尚下拉列表,我想执行回调javascript方法,当用户检查复选框时 – testCoder