跨域 Ajax 调用并在 Google App Engine 上维护会话
我最近经历了一系列对 GAE 应用程序进行跨域 ajax 调用的问题,它工作得很好,但是,我试图在进行所述服务调用时设置一个 http 会话 id,它工作得很好,除了每个当我执行请求时,会话再次为空。我假设这是因为 ajax 调用而不是通过 http 发出请求?我该怎么办?
I have recently worked through a bunch of kinks making cross-domain ajax calls to a GAE app and it is working beautifully, however, I am trying to set an http session id when making said service call and it is working fine, except that every time I perform the request, the session is null again. I'm assuming that this is because an ajax call and not making the request over http? How can I go about this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
会话跟踪通常使用 cookie 来完成。如果您使用跨源资源共享 (http://www.w3.org/TR/access-control/),则默认情况下请求中不包含 cookie。为了随您的请求一起发送 cookie,请将以下内容添加到您的 XmlHttpRequest:
Session tracking is usually done with cookies. If you are using Cross-Origin Resource Sharing (http://www.w3.org/TR/access-control/), then cookies are not included in the request by default. In order to send cookies along with your request, add the following to your XmlHttpRequest: