Hi!

I can't get the if-modified-since header to work with jquery ajax.

I tried to fet an xml like this:

$.get("url", function(xml){
         //Do something with response.
         }, "xml");

On these requests the if-modified-since is not set.

Then I tried like this:

$.ajax({
            type: "GET",
            url: "url",
            dataType: "xml",
            complete: function(XMLHttpRequest, textStatus){

            },
            ifModified: true,
            cache: true
        });

This cause the if-modified-since to be set to:  Thu, 01 Jan 1970
00:00:00 GMT

If I just load the url in the browser directly the headers are set
correctly and the server can return a 304.

These are the request headers:

Host    localhost:8080
User-Agent      Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5)
Gecko/20091102 Firefox/3.5.5
Accept  application/xml, text/xml, */*
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive      300
Connection      keep-alive
If-Modified-Since       Thu, 01 Jan 1970 00:00:00 GMT
X-Requested-With        XMLHttpRequest
Referer http://localhost:8080/
Cookie  __utma=1.1594413898.1260294412.1260294412.1260294412.1;
__utmc=1; __utmz=1.1260294412.1.1.utmcsr=(direct)|utmccn=(direct)|
utmcmd=(none); re_ret=0; re_ses=UQskC-7167631552; re_ses_indx=2;
position=57.717%2C11.967%2C11


And here are the response headers:

Server  Development/1.0
Date    Tue, 08 Dec 2009 19:30:05 GMT
Content-Type    text/xml
Cache-Control   public, max-age=3600
Last-Modified   Tue, 08 Dec 2009 18:49:08 GMT
Expires Tue, 08 Dec 2009 19:49:08 GMT
Content-Length  148018

Why does not jquery ajax set the correct if-modifed-since header?

//Magnus

Reply via email to