以1000条记录的步长检索所有记录

时间:2017-12-04 16:31:19

标签: javascript dojo

我正在对一个URL进行dojo.xhrPost,一次只能提供1000条记录,但我总共有近2500条记录。

我想检查响应,如果等于1000条记录,我需要再次发布帖子并获取接下来的1000条记录并执行相同操作直到响应大小小于1000条。

var params = {              
    url: uri,
    handleAs: "json",       
    load: dojo.hitch(this, "onGeoDropDownLoad"),
    error: dojo.hitch(this, "onGeoDropDownError"),
    headers: {
        'X-Requested-With': null,
        'Content-Type': 'text/plain'
    },
    sync: true
};

dojo.xhrPost(params);

如果成功,我正在做一些回应

onGeoDropDownLoad: function(response, ioArgs) {
    console.log("LocateWidget::onGeoDropDownLoad");
    // Processing user specific configuration returned by the server
    if ( response.features ){
    }
}

我可以通过response.features.size看到响应的大小。

如果我可以实现我正在寻找的东西,我可以使用javascript而不是dojo。

0 个答案:

没有答案