在Ajax.ActionLink的OnBegin,onComplete等事件中使用this【解决办法】

方法就是修改这个文件【jquery.unobtrusive-ajax.js】
options.data.push({ name: "X-Requested-With", value: "XMLHttpRequest" });

options.context = element; // <--- 100行附近加上这句代码

method = options.type.toUpperCase();
if (!isMethodProxySafe(method)) {
    options.type = "POST";
    options.data.push({ name: "X-HTTP-Method-Override", value: method });
}

 【参考文献】http://stackoverflow.com/questions/6630189/how-to-use-this-inside-mvc3-ajax-actionlink-onbegin-oncomplete-events

posted @ 2016-04-07 22:42  屠一刀  阅读(445)  评论(0编辑  收藏  举报