【发布时间】:2014-01-02 20:37:27
【问题描述】:
我在我的 ASP.Net 4.0 应用程序中本地有一个 WCF 服务。我的 MasterPage 中有以下内容:
<asp:ScriptManager runat="server">
<Services>
<asp:ServiceReference Path="~/Services/AJAXDataService.svc" />
</Services>
</asp:ScriptManager>
然后在我的页面上我有以下 JavaScript 代码:
...
5 calls to the service to fill in drop downs and such
...
$(document).ajaxStop(function () {
var service = new BOR.AJAXDataService();
service.GetComplaintDetails(passed, FillComplaint, DefaultFailure, null);
}); // AjaxStop - Event - Everything is done, now load the Model
这发生在大约 5 次其他 ajax 调用之后的 Document Ready 事件中。如果我不将它放在 ajaxStop 事件中,它会起作用,但取决于数据库和网络延迟,它可能不起作用,因为 GetComplaintDetails 需要从之前的每个调用中返回的内容。
我找到了 ajaxStop 方法,并认为它正是我所需要的。但显然 Microsoft/ScriptManager 调用不通过 jQuery(当然),因此该功能毫无意义。
问:在使用 ScriptManager 引用时,有没有办法拦截之前每个调用的being/end、start/stop 事件?我宁愿这样做,也不愿创建冗长冗长的 jQuery 调用。
【问题讨论】:
标签: javascript asp.net jquery