ASP.NET请求超时,从jQuery调用ASMX中的异步Web方法
创始人
2024-11-12 06:00:24
0

将Async="true"添加到ASMX中的Web方法,并在jQuery Ajax请求中添加async: true选项。

示例代码:

ASMX中的Web方法:

[WebMethod] [ScriptMethod(UseHttpGet = true)] public void MyWebMethod(string param1) { // Some code here }

更改为异步方法:

[WebMethod] [ScriptMethod(UseHttpGet = true, Async = true)] public IAsyncResult BeginMyWebMethod(string param1, AsyncCallback callback, object asyncState) { // Some code here }

[WebMethod] [ScriptMethod(UseHttpGet = true, Async = true)] public void EndMyWebMethod(IAsyncResult result) { // Some code here }

在jQuery中添加async选项:

$.ajax({ url: "MyWebService.asmx/MyWebMethod", data: { param1: "value1" }, type: "GET", contentType: "application/json; charset=utf-8", dataType: "json", async: true, success: function (response) { // Some code here }, error: function (xhr, textStatus, errorThrown) { // Some code here } });

相关内容

热门资讯

热点推荐!竞技联盟辅助插件,w... 热点推荐!竞技联盟辅助插件,wepoker破解器有用吗,黑科技教程(有挂教程)1、不需要AI权限,帮...
总算了解!wepoker有没有... 1、总算了解!wepoker有没有透视方法,hhpoker的辅助是真的吗,我来教教你(有挂教程);详...
新手必备!wepoker分析,... 新手必备!wepoker分析,wepoker黑侠破解,透明教程(有挂透明);wepoker黑侠破解软...
信息共享!德扑HHpoker有... 信息共享!德扑HHpoker有挂吗,约局吧辅助器,攻略方法(有挂神器)科技教程也叫必备教程,这是一款...
总算清楚!hhpoker怎么破... 总算清楚!hhpoker怎么破解,aapoker ai插件,实用技巧(有挂教程);致您一封信;亲爱h...
重大通报!xpoker怎么作弊... 重大通报!xpoker怎么作弊,wepoker好友局透视,第三方教程(有挂教程);支持2-10人实时...
玩家必看科普!wepoker手... 玩家必看科普!wepoker手机助手,拱趴大菠萝辅助神器,辅助教程(有挂透视);人气非常高,ai更新...
发现一款!wepoker有透视... 发现一款!wepoker有透视吗,德州透视竞技联盟,新2025教程(有挂透视);玩家必备必赢加哟《1...
攻略讲解!wepoker私人局... 攻略讲解!wepoker私人局规律,hhpoker透视工具,安装教程(有挂透明);实战中需综合运用上...
教程攻略!德普之星有辅助软件吗... 教程攻略!德普之星有辅助软件吗,wepoker永久免费脚本,系统教程(有挂神器);科技安装教程;13...