进度参考代码
2016-02-27 14:02
246 查看
1.按钮点击的时候开始监视进度 var interval = window.setInterval(GlobalControlProcess, 1500); 2.js调用一般处理程序轮询进度 function GlobalControlProcess(){ $.post("/Common/ComputeProcess.ashx", {ComputeType:"rsk_pro"},function(data){ data=JSON.parse(data); if (data.state.toString() == "7") { SetCompleted(); window.clearInterval(interval); } else{ SetPorgressBar(Math.ceil(parseInt(data.state)/7*100)); $("#p"+data.state.toString()).fadeIn("slow"); } }); 3.进度完成后清除计时器 window.clearInterval(interval); 4.一般处理程序代码 using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Web; using Contract.Domain; using Framework; using NPOI.SS.Formula.Functions; using WebApp.Common; namespace HraWeb.Common { /// <summary> /// EntityJsonList 的摘要说明 /// </summary> public class ComputeProcess : BasePage, IHttpHandler, System.Web.SessionState.IRequiresSessionState { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //context.Response.ContentType = "application/json"; context.Response.Cache.SetCacheability(HttpCacheability.NoCache); if (context.Request["ComputeType"]!=null&&!string.IsNullOrEmpty(context.Request["ComputeType"])) { string computeType = context.Request["ComputeType"]; if (HttpContext.Current.Session[computeType] == null) { HttpContext.Current.Session.Add(computeType,1); } var obj = new {state = HttpContext.Current.Session[computeType.ToString()]}; context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(obj)); context.Response.End(); } } public bool IsReusable { get { return false; } } } }
相关文章推荐
- c++(重载、覆盖、隐藏)
- c语言库函数 qsort(快速排序函数)
- java-字符串学习总结
- Python标准库:内置函数classmethod(function)
- javaWEB简单商城项目(四)
- UVA 11971(p335)----Polygon
- 树莓派安装 python3 及 python IDE
- Java的IO流
- 我的Python成长之路---第六天---Python基础(19)---2016年2月20日(晴)
- 【CI学习笔记】一个用PHP写的,简单的MVC实例
- [C++ Calculator 项目] 初试
- C语言(类型转换)
- XAMPPS1.8.5工具单独升级php版本(5.2升级到5.4.45)
- springIOC
- UVA 11054(p237)----Wine trading in Gergovia
- spirngMVC+Hibernate+SpringSecuirty+Extjs一个简单的权限管理系统
- Java爬虫~~爬虫伪代码
- HashMap的使用,简单小代码
- Python学习笔记(四) 多重继承及内部算法解析
- 关于C++编译时内链接和外链接