C# jqueryajax是否可以在运行时根据被调用的webmethod的进度进行更新?
我在服务器上有一个调用Webmethod的ajax查询,Webmethod执行了一系列操作,然后返回一个值,我在ajax的onSuccess部分使用该值 我的问题是。。是否有一种方法可以在运行Webmethod时通知客户端脚本Webmethod的状态。i、 e.如果它运行100次循环,它将在每次迭代开始时通知 jQuery AJAX:C# jqueryajax是否可以在运行时根据被调用的webmethod的进度进行更新?,c#,jquery,.net,ajax,webmethod,C#,Jquery,.net,Ajax,Webmethod,我在服务器上有一个调用Webmethod的ajax查询,Webmethod执行了一系列操作,然后返回一个值,我在ajax的onSuccess部分使用该值 我的问题是。。是否有一种方法可以在运行Webmethod时通知客户端脚本Webmethod的状态。i、 e.如果它运行100次循环,它将在每次迭代开始时通知 jQuery AJAX: `$.ajax({ type: "POST", url: "Whatsapp.aspx/GetProgress",
`$.ajax({
type: "POST",
url: "Whatsapp.aspx/GetProgress",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
// do stuff with result
},
error: function (xhr, textStatus, errorThrown) {
alert("function error:" + xhr.statusText + "\n" + textStatus + "\n" + errorThrown);
if (window.console) console.log(xhr);
}
});`
以及codebehind上的WebMethod:
[WebMethod]
public static int GetProgress()
{
for()
{
//notify the client a start of a new iteration?????
//do lots of stuff here
}
//return the end result
}
可能是重复的,您可能需要查看信号R