循环同步Ajax xmlhttp请求不在IE中刷新 [英] Looping synchronous Ajax xmlhttp requests not refreshing in IE
问题描述
我有一个循环,我正在制作Ajax xmlhttp请求。这发生在由window.onload事件触发的函数中。
使用async = false进行Ajax调用,因为它们需要按照依赖于每个步骤的特定顺序进行在下一次发生之前完成。
循环中的每个连续请求,我都在用xmlhttp.responseText更新一个div。
Firefox根据需要在通话之间刷新。
IE不是。循环开始时,div将填充预循环内容。当循环结束时,div将填充在循环外发生的第一次刷新。
有人可以帮忙吗?
两个尝试的解决方案:
1.在GET查询字符串的末尾添加一个随机字符串以确保唯一的URL
2.使用POST方法提交
两者都没有运气。
谢谢。
Hi,
I have a loop in which I''m making Ajax xmlhttp requests. This occurs within a function triggered by a window.onload event.
The Ajax calls are being made with async=false, because they need to occur in a specific order that relies on each step completing before the next can occur.
With each successive request in the loop, I''m updating a div with the xmlhttp.responseText.
Firefox is refreshing between calls as desired.
IE is not. When the loop begins, the div is populated with the pre-loop content. When the loop finishes, the div is populated with the first refresh that occurs outside of the loop.
Can someone please help?
Two attempted solutions:
1. Adding a random string to the end of the GET query string to ensure a unique url
2. Submitting with the POST method
No luck with either.
Thanks.
推荐答案
我需要查看代码不仅仅是猜测。
I would need to see the code to make more than a guess.
好吧,for ... in循环不适合循环数组,更好地使用标准for()循环。
well, a for … in loop is not the suited structure to loop over an array, better use a standard for() loop.
这篇关于循环同步Ajax xmlhttp请求不在IE中刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!