Access the caller DOM-object from the OnBegin function from AjaxAction
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
精彩评论