Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.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
Javascript 如何为长请求显示progressbar式的增量状态更新_Javascript_Asp.net_C# 4.0 - Fatal编程技术网

Javascript 如何为长请求显示progressbar式的增量状态更新

Javascript 如何为长请求显示progressbar式的增量状态更新,javascript,asp.net,c#-4.0,Javascript,Asp.net,C# 4.0,我必须在我的Asp.net应用程序中向服务器发送长期请求,该请求我调用了4个服务,每个服务最多需要1分钟,因此我想显示prograssbar哪个服务已完成,我搜索了一个链接,我的概念是正确的,但该链接使用iframe加载另一个页面,页面写入方法类似 protected void UpdateProgress(int PercentComplete, string Message) { // Write out the parent script callback. Response.Wr

我必须在我的Asp.net应用程序中向服务器发送长期请求,该请求我调用了4个服务,每个服务最多需要1分钟,因此我想显示prograssbar哪个服务已完成,我搜索了一个链接,我的概念是正确的,但该链接使用iframe加载另一个页面,页面写入方法类似

protected void UpdateProgress(int PercentComplete, string Message)
{
  // Write out the parent script callback.
  Response.Write(String.Format(
    "<script>parent.UpdateProgress({0}, '{1}');</script>", 
    PercentComplete, Message));
  // To be sure the response isn't buffered on the server.
  Response.Flush();
}
protectedvoid UpdateProgress(整数百分比完成,字符串消息)
{
//写出父脚本回调。
Response.Write(String.Format(
“parent.UpdateProgress({0},{1}”);”,
完成百分比,消息);
//确保响应未在服务器上缓冲。
Response.Flush();
}
在这段代码中,调用父aspx页面中的javascript函数来更新详细信息,但我在同一页面中处理了这个概念,我删除了“parent”。在我的代码中,得到了预期的错误对象如何在jQuery的帮助下在单个页面中编写代码

(http://jQuery.com)您可以在javascript中执行以下操作:

function callServices() {
   var serviceUrls = ["http://yourdomain/svc1", "http://yourdomain/svc2", "http://yourdomain/svc3", "http://yourdomain/svc4"];
   for(i = 0; i < serviceUrls.length; i++) {
      $.ajax(serviceUrls[i], function(){ updateStatus("Service " + i); });
   }
}

function updateStatus(svc) {
    $("#statusBar").append("<span>" + svc + " has finished.</span>");
}
函数调用服务(){
var serviceURL=[”http://yourdomain/svc1", "http://yourdomain/svc2", "http://yourdomain/svc3", "http://yourdomain/svc4"];
对于(i=0;i
干杯