阿贾克斯更新不工作在Internet Explorer工作、阿贾克斯、Explorer、Internet

2023-09-11 01:08:49 作者:。小小的世界有大大的梦想。

喜 我有一个AJAX更新,我不可能解决问题。 我有这个code Servicii

Hi I have a problem with ajax updater that i couldnt solve. I have this code Servicii

它完美的Firefox,但在Internet Explorer它nothing.Also如果我从我的硬盘打开网站,它的工作原理,但它仅适用于链接一次,然后我必须重新加载整个页面...

It works perfectly in firefox but in internet explorer it does nothing.Also if i open the site from my harddrive it works but it only works for the link once then i have to reload the whole page...

是否有人对如何解决这一问题的IDEEA?

Does anybody have an ideea on how to solve this problem?

感谢您

推荐答案

我有这个确切的问题。我假设你有一个函数,它定期发出请求到服务器获取数据,然后更新页面,如果因为你提出要求的最后一次数据已经改变。

I've had this exact problem. I'm assuming that you've got a function which periodically makes a request to the server to fetch data then updates the page if that data has changed since the last time you made the request.

Internet Explorer将缓存的Ajax调用的结果,即使你告诉它不要在你的HTTP头相同的资源。所以,如果你犯了一个请求 GET_DATA?ID =什么一遍又一遍,IE浏览器会发出请求一次,然后停止制造它的未来,只是返回的结果第一请求。

Internet Explorer will cache the results of Ajax calls to the same resource even if you tell it not to in your HTTP headers. So if you make a request to get_data?id=whatever over and over again, IE will make the request once and then stop making it in the future and simply return the result of the first request.

的解决方案是一个虚设参数添加到请求字符串。所以,首先你要求 GET_DATA ID =无论&放大器;?ie_hack = 0 然后 GET_DATA ID =无论&放大器; ie_hack = 1 等这将阻止IE浏览器缓存的结果,并迫使它使每一次的要求,因为它看到了每个请求一个不同的查询字符串。

The solution is to add a dummy parameter to the request string. So first you request get_data?id=whatever&ie_hack=0 then get_data?id=whatever&ie_hack=1 etc. This will stop IE from caching the results and force it to make the request each time, since it sees a different query string for each request.