延迟ajaxStart n秒

时间:2015-08-19 02:58:59

标签: jquery ajax

如何延迟$scope.ourDataName = []; $http.get(URL).success(function (data) { angular.forEach(data, function(drug) { $scope.ourDataName.push(drug.drug_name); }); }); ajaxStart() n秒,这样每个人都可以看到我的动画gif。否则它会过快消失。请指教。感谢。

ajaxStop()

1 个答案:

答案 0 :(得分:3)

您可以使用超时来执行此操作

    IndicesStatsResponse indicesStatsResponse = StartTCPService.getClient()
            .admin()
            .indices()
            .prepareStats(index_name)
            .all()
            .execute().actionGet();

    XContentBuilder builder = XContentFactory.jsonBuilder();
    builder.startObject();
    indicesStatsResponse.toXContent(builder, ToXContent.EMPTY_PARAMS);
    builder.endObject();
    String jsonResponse = builder.prettyPrint().string();

    JsonParser jsonParser = new JsonParser(); // from import com.google.gson.JsonParser;
    Long sizeOfIndex = jsonParser.parse(jsonResponse)
            .getAsJsonObject().get("_all")
            .getAsJsonObject().get("primaries")
            .getAsJsonObject().get("store")
            .getAsJsonObject().get("size_in_bytes").getAsLong();

    System.out.println(sizeOfIndex); // this is in Bytes