我有一个像这样的Ajax.ActionLink:
@Ajax.ActionLink("Load Related Titles",
"AjaxLoadRelated",
"Shared",
new { RelatedComics = c.RelatedComic.RelatedTitles },
new AjaxOptions() { HttpMethod = "Get", UpdateTargetId = "divRelatedTitles", LoadingElementId = "divLoading", OnBegin = "ajaxLoadMoreBegin", OnFailure = "ajaxLoadMoreFailed", OnSuccess = "ajaxLoadMoreSuccess" })
Run Code Online (Sandbox Code Playgroud)
目前我的OnSuccess函数如下所示:
function ajaxLoadMoreSuccess() {
...
}
Run Code Online (Sandbox Code Playgroud)
我想向它提出一个论点:
function ajaxLoadMoreSuccess(myArg) {
...
}
Run Code Online (Sandbox Code Playgroud)
这可能吗?
提前致谢
小智 8
这是可能的.mvc ajax不显眼的脚本使用三个参数(对应于jquery ajax完整方法的参数)数据,状态,xhr创建一个匿名函数,并使用jquery ajax完整方法的参数调用该方法.例如:
...OnSuccess = "ajaxLoadMoreSuccess1('hello world')"
要么
...OnSuccess = "ajaxLoadMoreSuccess2(calc(), data, status, xhr)"
<script type="text/javascript">
function ajaxLoadMoreSuccess1(message) {
alert(message);
}
function ajaxLoadMoreSuccess2(x, data, status, xhr) {
$('#somespan').text('calc was ' + x + ' and data is ' + data);
}
function calc() {
return 1 + 2;
}
</script>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2191 次 |
| 最近记录: |