如何在条件内自动刷新我的Ajax

时间:2018-04-13 12:10:33

标签: javascript

使用以下方法给我一个错误说明unknock资源,那么应该把setInterval放在哪里?

   $("#faultstat").click(function(e) {
      var dtFrom = $("#datepickerFrom").val();
      var dtTo = $("#datepickerTo").val();
      tmp = $("#multiselect").val();

     setInterval(

         $.ajax({

             dataType: "json",
             type: "POST",
             url: "@Url.Action("SumAndAverage","Ranking")",
             contentType: "application/json; charset=utf-8",
             data: JSON.stringify({ "regionalManager": tmpString, "dtFrom": dtFrom, "dtTo": dtTo }),
             success: function (result) {

                 var average = result.sumOfProAndAvg[0].avg;
                 var sumOfpro = result.sumOfProAndAvg[0].sum;
                 var failed = result.fld.Text;
                 var disabled = result.dsld.Text;
                 var powerConv = result.pwr.Text;

             }
         }), 30000);

 });

0 个答案:

没有答案