在ASP.NET AJAX扩展器控件中的WebMethod呼叫问题
-
11-12-2019 - |
题
我有一个扩展器控制,并希望从中呼叫WebMethod。但既不是sys.net.webserviceproxy.invoke也没有$ .ajax工作。$ .ajax问题服务器超时错误。调用工作但不调用Web方法。代码低于
[WebMethod]
public static string calculateTime(string dateTime) {
return result;
}
.
调用webmethod的扩展器控件中的方法。
timer: function(){
Sys.Net.WebServiceProxy.invoke("CaculateTime.asmx", "calculateTime",false,{"dateTime":""+this._timestamp+""}, function (result, e){ this.get_element().innerText=result ;}, function(result, e){},"User Context", 100);
},
. 解决方案 2
我使用的路径地址为“calculateTime.asmx”。但是,ASP.NET是这种情况。我正在从javascript中致电它,所以它应该是“http:// localhost:18194 / applicationname / calculate.asmx / calmulatetime”。它浪费了很多时间。
其他提示
从static
中删除calculateTime
修改器。我相信你对页面方法感到困惑,那些确实必须是静态来允许异步呼叫。
不隶属于 StackOverflow