初学者:django json缓存控制IE进度条

时间:2012-03-21 20:39:03

标签: django internet-explorer

免责声明:我是django的初学者,但具有drupal编码经验

在研究IE缓存控制问题后(http://stackoverflow.com/questions/1294155/ajax-request-that-returns-json-array-ie6-7-is-caching-it-and-data-是不是很新鲜),我的.getJSON(刷新每200毫秒以更新.jqueryui进度条)在Firefox中工作得很好,但不是IE,尽管迫使IE不要缓存,如下所示:

#views.py
...
response = HttpResponse(vars,mimetype='application/json; charset=utf8')
response['Cache-Control'] = 'no-cache'
return response    

在IE 9的Fiddler中,我收到以下内容,显示IE正在发送请求:

URL Method  Result  Type    Received    Taken   Initiator   Wait‎‎  Start‎‎     Request‎‎   Response‎‎  Cache read‎‎    Gap‎‎

/import-cmd-get-progress/?_=1332361628456   GET 200 application/json    166 B   < 1 ms  JS Library XMLHttpRequest   11248   0   0   0   0   203

/import-cmd-get-progress/?_=1332361628566   GET 200 application/json    166 B   16 ms   JS Library XMLHttpRequest   11357   0   16  0   0   78
/import-cmd-get-progress/?_=1332361628657   GET 200 application/json    166 B   < 1 ms  JS Library XMLHttpRequest   11451   0   0   0   0   0

但不知何故,IE不会显示进度条,所以我怀疑我发送了错误的标题。思考?同样,这在Firefox中也很有用。

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。问题是我的编程很糟糕。我回来了

[object {something:something}]

而不是

{something:something}

Firefox了解我的数据[0],但不了解Internet Explorer。