Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# jqueryajax是否可以在运行时根据被调用的webmethod的进度进行更新?_C#_Jquery_.net_Ajax_Webmethod - Fatal编程技术网

C# jqueryajax是否可以在运行时根据被调用的webmethod的进度进行更新?

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",

我在服务器上有一个调用Webmethod的ajax查询,Webmethod执行了一系列操作,然后返回一个值,我在ajax的onSuccess部分使用该值

我的问题是。。是否有一种方法可以在运行Webmethod时通知客户端脚本Webmethod的状态。i、 e.如果它运行100次循环,它将在每次迭代开始时通知

jQuery AJAX:

    `$.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