数据批量插入,返回当前成功数量

 

     private int num = 0;

        [HttpPost]
        public void sendIndex()
        {
            Thread t =new Thread(new ThreadStart(aaa));
            t.Start();
           
        }

        public void aaa()
        {
            for (int a = 0; a < 10; a++)
            {
                System.Web.Caching.Cache objCache = HttpRuntime.Cache;
                objCache.Insert("pc", a);
                Thread.Sleep(1000);
            }
        }

        [HttpPost]
        public string getIndex()
        {
            System.Web.Caching.Cache objCache = HttpRuntime.Cache;
            return objCache["pc"].ToString();
        }

 

 window.setInterval(function() {
                $.post("/zh-cn/institutionalRevision/getIndex", null, function (r) {
                    alert(r);
                });
            }, 3000);
            $.post("/zh-cn/institutionalRevision/sendIndex", null, function () {

            });

 

posted on 2015-07-16 11:34  忙碌ing  阅读(581)  评论(0)    收藏  举报

导航