无法通过IE中的AJAX更改会话变量 [英] Unable to change session variable through AJAX in IE

查看:165
本文介绍了无法通过IE中的AJAX更改会话变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当IE尝试使用AJAX更改服务器上的会话变量时,我从IE中获得了一些奇怪的行为。它在FF,Chrome,Safari和所有其他我测试但不是在IE中正常工作。

I'm getting some weird behavior from IE when trying to change a session variable on the server using AJAX. It works fine in FF, Chrome, Safari, and all the others I've tested but not in IE.

我正在维护变量列表(整数)一个会话变量为匿名用户,所以我可以保留他们的数据/如果他们在网站上注册。我正在使用jQuery和AJAX调用更新会话变量的Django函数。

I'm maintaining a list of variables (integers) in a session variable for anonymous users so I can keep their data when/if they register on the site. I'm using jQuery and AJAX to call a Django function that updates the session variable.

IE中的奇怪的行为是刷新(再次点击服务器)会话仍未更新。只有当我清除浏览器缓存或查看当前的Cookie,会话更新。

The odd behavior in IE is that on refresh (hitting the server again) the session is still not updated. Only when I clear the browser cache or view current cookies does the session update.

任何想法?

推荐答案

我有同样的问题,与Pylons,我所做的是创建一个中间件,在我的响应头中设置以下配置。

I had the same problem, but with Pylons, what I did was create a middleware that set the following configuration in my response headers.

headers["Cache-Control"] = "no-cache"
headers["Pragma"] = "no-cache"
headers["Expires"] = -

这里是一个描述这是什么。

Here is a description on what this does.

这篇关于无法通过IE中的AJAX更改会话变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆