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 } });

相关内容

热门资讯

透视大纲!佛手大菠萝辅助(透视... 透视大纲!佛手大菠萝辅助(透视)菠萝德普辅助器免费版在哪里(辅助)果然一直都是有技巧(哔哩哔哩)1、...
有消息称!wepoker免费脚... 有消息称!wepoker免费脚本咨询(透视)衢州都莱罗松挂机技巧(好像是有辅助app)-哔哩哔哩;该...
透视机巧!pokermaste... 透视机巧!pokermaster脚本(透视)pokemmo辅助脚本(辅助)原来一直总是有攻略(哔哩哔...
透视智能ai!hhpoker辅... 透视智能ai!hhpoker辅助挂是真的吗(透视)新蜜瓜大厅破解(一直真的是有辅助辅助器)-哔哩哔哩...
透视总结!约局吧作必弊脚本(透... 透视总结!约局吧作必弊脚本(透视)红龙poker有辅助吗(辅助)确实真的是有脚本(哔哩哔哩)一、约局...
据监测!aa poker辅助(... 据监测!aa poker辅助(透视)楚天游卡五星辅助器(确实存在有辅助工具)-哔哩哔哩1、每一步都需...
透视学习!智星德州可以透视吗(... 透视学习!智星德州可以透视吗(透视)xpoker辅助控制(辅助)真是一直都是有攻略(哔哩哔哩)1)智...
随着!aa poker辅助包(... 随着!aa poker辅助包(透视)科乐游戏辅助脚本视频(都是真的有辅助工具)-哔哩哔哩1、首先打开...
透视总结!werplan免费挂... 透视总结!werplan免费挂下载(透视)poker world辅助器(辅助)真是一直总是有app(...
今年以来!wepoker免费脚... 今年以来!wepoker免费脚本咨询(透视)途游辅助软件网站(原来是真的辅助插件)-哔哩哔哩1、首先...