SOME TIMES there is no X-Requested-With header, sometimes there is.
I checked in firebug and found that, don't know why.
So when I use request.is_ajax in django, it fails sometimes.
Anyone know how to fix it?
OK, now it happened again. I opened the page and then left for supper for a long while, when I came back, it happened again. I recorded request header in firbugs:
Request with X-Requested-with:
Host localhost:8000
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.2; zh-CN; rv:1.9.1.5) Gecko/20091102
Firefox/3.5.5
Accept text/html, /
Accept-Language zh-cn,zh;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset GB2312,utf-8;q=0.7,*;q=0.7
Keep-Alive 300
Connection keep-alive
X-Requested-With XMLHttpRequest
Refererhttp://localhost:8000/gallery/
Cookie xxx
Request without X-Requested-with:
Host localhost:8000
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.2; zh-CN; rv:1.9.1.5) Gecko/20091102
Firefox/3.5.5 Accept text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Language zh-cn,zh;q=0.5 Accept-Encoding gzip,deflate
Accept-Charset GB2312,utf-8;q=0.7,*;q=0.7
Keep-Alive 300
Connection keep-alive
Refererhttp://localhost:8000/gallery/
Cookie xxx