开发者

Access the caller DOM-object from the OnBegin function from AjaxAction

开发者 https://www.devze.com 2023-02-09 16:54 出处:网络
Problem: access the DOM-object that called the AjaxAction in the OnBegin function. Here is one solution: Question about parameters in OnBegin AjaxOptions

Problem: access the DOM-object that called the AjaxAction in the OnBegin function. Here is one solution: Question about parameters in OnBegin AjaxOptions Is there a cleaner way to access it?

Examples like these do not work:

function beginContactList(args) { // this is the OnBegin
    // Highlight selected group
    $('#leftColumn li').removeClass('selected');
    $(this).parent().addClass('selected');

    // Animate
    $('#tabs-1开发者_如何学编程').fadeOut('normal');
}

Because the this object is does not contain information about the DOM.


Checkout the answer to this question, there they talk about automatically inject additional parameters into the ajax context:
ASP.NET MVC : AJAX ActionLink- Target an HTML attribute

0

精彩评论

暂无评论...
验证码 换一张
取 消