Hi All,
I have a web application that utilises both the MVC Ajax calls:
Html.ActionLink()
rendering as Sys.Mvc.AsyncForm.handleClick(
in the page source
and: jQuery Ajax calls, eg:
$.post()
Now I can easily set a generic Ajax indicator to show and hide when the jQuery is making an Async call using:
$('#indicatorId').ajaxStart(function() {
$(this).show();
}).ajaxStop(function() {
$(this).hide();
});
And I can set some functions to show and hide the same indicator by passing values into the constructor of the Ajax.ActionLink constructor and setting OnBegin
and OnComplete
, but this means that I have to do this EVERYTIME I add a new Ajax.ActionLink to the site.
Is there a better way to do this? Perhaps I could scan the DOM after it's rendered and add the generic events then?
Any thoughts, better examples?