Is there a way to call a javascript function every time an AJAX request is sent, and then another when the call is finished? I know you can do it individually for each form with the OnBegin and OnComplete functions, but I want a universal one.
Specifically, I would like the wait cursor to show every time it sends an ajax call, and then go back to the default cursor when done.
With webforms you could do
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);
but I need something for MVC 4.
Any suggestions on how to accomplish this task would be appreciated, or alternatives if it's just a bad idea.
Tr这个全局的ajax事件处理程序
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.