js发送请求

1.Chrome控制台中 net::ERR_CONNECTION_REFUSED

js频繁发送请求,有可能连接被拒绝,可用setTimeout,过几秒发送,给个缓冲时间

var overlayAnalystService = L.supermap.spatialAnalystService(serviceUrl);
setTimeout(function () {    
    var datasetOverlayAnalystParameters = new SuperMap.DatasetOverlayAnalystParameters({
          sourceDataset: dataset,
          operateRegions: [polygon],
          tolerance: 0,
          operation: SuperMap.OverlayOperationType.CLIP,
          resultSetting: new SuperMap.DataReturnOption({expectCount: 0})
      });
      overlayAnalystService.overlayAnalysis(datasetOverlayAnalystParameters, function (serviceResult) {
          if(serviceResult && serviceResult.result && serviceResult.result.recordset) {
              var features = serviceResult.result.recordset.features.features;
              ...
          }
      })
},
1000);

 

posted on 2017-11-23 10:36  樱影空子  阅读(371)  评论(0编辑  收藏  举报

导航