简体   繁体   English

通过Internet Explorer中的Ajax调用获取大数据(大约10000个项目)卡住了

[英]Getting Large data ( approx 10000 items ) by ajax call in Internet Explorer stuck

Getting large data( approx 10000 items for a list ) by ajax call in internet Explorer 8 is getting stuck. 在Internet Explorer 8中通过ajax调用获取大数据(一个列表大约10000个项目)被卡住了。 Other browsers like chrome browser, fire fox also getting stuck but it comes back soon( comes in few seconds ). 其他浏览器(例如chrome浏览器),fire fox也被卡住了,但很快就会回来(几秒钟内出现)。 Internet explorer takes huge time to respond ( Takes in minutes ). Internet Explorer需要花费大量时间进行响应(需要几分钟)。

Things that I've tried : after seeing the suggestions provided online. 我尝试过的事情:看到在线提供的建议后。

1) changed $.each method to for loop. 1)将$ .each方法更改为for循环。

2) concatenating the element in a string once all iterations are done then finally I'm appending. 2)一旦所有迭代都完成,就将字符串中的元素串联起来,最后我追加了。 Ie

for(......){

 finalList += "div"+response+"/div"

}
$("#List").append(fianlList)

3) In ajax call async property is given like = async: false 3)在ajax调用中,async属性的给出方式为= async:false

4) Also I've tried in filling all items in many ajax calls Ie, 1000 items in an ajax call and it'll just wait for 5 seconds then it'll make second,third..... until all are received. 4)我也尝试过在许多ajax调用中填充所有项目,例如,在ajax调用中填充1000个项目,它只需要等待5秒钟,那么它将排第二,第三.....,直到收到所有。 The 5 sec wait for the browser to get settled. 等待浏览器稳定5秒钟。 Is that right? 那正确吗?

Here, a) we cant show the content on ajax by typing the string in the text box, since we're required to show all the content. 在这里,a)我们不能通过在文本框中键入字符串来在ajax上显示内容,因为我们需要显示所有内容。 Because user will not be kn knowing what are all present. 因为用户不会知道所有的东西。 b) we can't load on demand by scrolling down which loads the further data, because we have search button in case user know about a particular item and he tries searching for it then it'll not be available if that is not loaded. b)我们无法通过向下滚动来加载更多数据,因此无法按需加载,因为我们有搜索按钮,以防用户知道某个特定项目,而他尝试搜索该项目,则如果未加载该项目将不可用。 Also we cant ask the user to scroll further to see more data because we don't know in which call he'll be getting the exact data. 同样,我们不能要求用户进一步滚动以查看更多数据,因为我们不知道他将在哪个呼叫中获取确切的数据。 c) writing in a CSV file and ask them to mark (Y / N) also won't be a better option. c)写入CSV文件并要求他们标记(Y / N)也不是更好的选择。

So guys can you please help me on this.Note : This happens mainly on IE(My version is 8). 所以大家可以帮我这个忙。注意:这主要发生在IE(我的版本是8)上。

You can optimize it by trying something like this: 您可以通过尝试以下方式对其进行优化:

var html = [], i = -1;
html[++i] = '<div>' + response + '</div>'
.
.
.
$("#List")[0].innerHTML = html.join('');

It's a way to improve your code. 这是一种改进代码的方法。 I've read about this in a book and the performance increase in IE7 was 37x 我已经在一本书中阅读了有关此内容的信息,IE7的性能提高了37倍

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM