Ajax, not modified and cache
Hi
I have trouble using the cache capabilities when the server replied with a 304 status.
I use JQuery 2.1.3. I tested my code with Chrome 44 and Firefox 38.0.5. Same results with both browsers.
Here is my ajax call:
-
$.ajax({
method: "GET",
url: "...",
ifModified: true
}).done(function (data, status, xhr) {
console.log("data: " + data)
console.log("status: " + status)
console.log("response: " + xhr.responseText)
})
The first call produces:
- "data: object"
- "status: success"
- "response: ..."
The second call produces:
- "data: undefined"
- "status: notmodified"
- "response: "
So the response is empty and the data is not usuable.
Is this the expected behavior ? With a 304 status, I would expect to have at least something in responseText.
If this is the expected behavior, what would be the proper way to support caching in my client ?
Thanks