"Not enough storage is available to complete this operation"- JQuery 加载 JSON 文件时出错

"Not enough storage is available to complete this operation"- JQuery error when loading JSON files

我正在使用 C3 charts 加载 3 个 JSON 文件来显示数据。

I use AJAX to load 3 JSON files when the page loads and we have to use IE11.

When ever the page loads, I keep on receiving this error "Not enough storage is available to complete this operation" in the jQuery file.

我应用了一个将禁用缓存的代码,但是,它工作了很短的时间然后出现了错误。拜托,你能坚持吗?我和我的团队一直在寻找解决此错误的方法。

是否有解决此问题的方法或解决方案?或者是否有一个库可以在页面加载期间管理它的内存?

仅供参考,

The total MB of those 3 JSON files are 140mb. Below is the code i use for getting the JSON files. I need these files to make the c3 chart work and fetching the information when clicking the bars. The last 2 AJAX are just storing the result into the JavaScript object.

$.ajax({
  url: "data/parsedAfterBlueBarClicked.json",
  type: "GET",
  dataType: "json",
  complete: function() { 
    //Remove the loading percentage div....
  },
  progress: function(evt) {
    if (evt.lengthComputable) {
      $(".loadingText").html("Loading... " +  parseInt( (evt.loaded / evt.total * 100), 10) + "%");            
    } else {
      console.log("Length not computable.");
    }
  },
  progressUpload: function(evt) {
    // See above
  },
  success: function(data) {
    getGroupAndItemsJSON = data;
  } 
});

//get groupDetails JSON using AJAX 
$.getJSON("data/parsedGroupDetails.json", function(result) {
  getGroupDetailsJSON = result;
}).fail(function() {
  console.log("failed to load parsedGroupDetails.json");
}).done(function() {
  parsedGroupDetailsDone = true;
});  
        
//begin .getJSON for file parsedOrangeBarGraph.json
//  data/groupFilterItems.json
$.getJSON("data/parsedOrangeBarGraph.json", function(result) {
  getlistGroupAndItemsArray = result;
}).fail(function() {
  console.log("failed to load parsedOrangeBarGraph.json");
}).done(function() {
  parsedOrangeBarGraphDone = true;
});  

谢谢!

在我看来,您需要为此考虑一种不同的方法。一次加载 140mb 的数据是不可能的。也许在 2117 年会很正常,但今天不是这样!

我认为这一定是一个巨大的 table 案例,您需要展示它。因此,在那种情况下,您应该将其分解成几个部分,仅在需要时加载。例如,您可以一次发送 20~50 行,然后如果用户选择执行另一个 select,为下一页带来新的 json。

我可能是在推断这里的假设,对此我深表歉意,但如果您仍然在巨大的 table 场景中担心过滤器,请不要担心。您始终可以使用手头的过滤器对数据库执行新请求。这将加快搜索速度。

我的问题已经解决了。是的,最好的方法是在后端(JAVA 端)加载那些 JSON 文件。因此,当我单击 C3 图表中的条形图时,我只需要获取索引号即可。获取该索引并使用 Ajax 调用另一个 JSP 文件以将索引值发送到 java 方法中。索引值将从 JAVA 中的 JSON 对象中获取数据(JSON 文件已经加载到 JAVA 端并将其存储到 JAVA Bean getters/setters)。然后取回数据并发送响应。效果很好,我点击刷新超过 15 次,但我没有看到该错误。我希望这解释得很好。

谢谢!