简体   繁体   中英

How to deal with 304 Not Modified in a XMLHttpRequest

Morning folks,

I'm hoping someone can help me understand how to deal with 304 responses.

I have a web page that generates it's content dynamically by getting data from a REST Service using a XMLHttpRequest object, then updates the contents of the webpage.

Currently if the data is requested again within it's max-age, the REST Service returns the cached data and a Status Code of 200, but it going to change to returning no data and a 304 Status Code. I did a few quick tests of my own and as there is no data returned I have no data to display. So I'm kinda stuck on how this how process works.

I've seen lots of questions and answers explaining why and when 304 should be used, but can't find how to handle the 304 in the client code.

Hope someone can help.

好了,解决方案非常简单,在IE中测试时,我已将“始终从服务器刷新”设置。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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