无法读取前一个请求AJAX设置的$ _SESSION变量 [英] Can't read $_SESSION variables set by previous request, AJAX

查看:79
本文介绍了无法读取前一个请求AJAX设置的$ _SESSION变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面加载,并调用一个init()函数,该函数将内容返回到页面上的

div,以及设置$ _SESSION变量。它返回的内容

包含一个调用相同变量的链接,但是我得到一个

错误,表示索引没有定义。


后两个调用是AJAX生成的。第二次调用

在设置它之后回复$ _SESSION变量,并将其设置为正确的
。但随后的请求并没有看到它。


我无法想出这一点,这种功能对于

至关重要我正在建设。


我已经完成的事情:


将session_start()放入后调用的函数中最初的

页面加载。只是生成会话已经启动的警告(原始页面加载)。


选中以确保所有请求都使用相同的会话,

,它是(根据session_id)。


任何帮助表示赞赏。

My page loads, and calls an init() function that returns content to a
div on the page, as well as setting a $_SESSION variable. The content
it returns includes a link that calls the same variable, but I get an
error that says the index isn''t defined.

The second two calls are AJAX-generated. The second call immediately
echos the $_SESSION variable back after it sets it, and it sets it
properly. But the subsequent request doesn''t see it.

I can''t figure this one out, and this sort of function is vital to the
site I''m building.

Things I''ve already done:

Put session_start() in the functions that get called after the initial
pageload. Just generates warnings that a session has already been
started (by the original pageload).

Checked to make sure the same session is being used by all requests,
and it is (according to session_id).

Any help is appreciated.

推荐答案

_SESSION变量。它返回的内容

包含一个调用相同变量的链接,但是我得到一个

错误,表示索引没有定义。


后两个调用是AJAX生成的。第二次调用

回设
_SESSION variable. The content
it returns includes a link that calls the same variable, but I get an
error that says the index isn''t defined.

The second two calls are AJAX-generated. The second call immediately
echos the


_SESSION变量,然后将其设置为

。但随后的请求并没有看到它。


我无法想出这一点,这种功能对于

至关重要我正在建设。


我已经完成的事情:


将session_start()放入后调用的函数中最初的

页面加载。只是生成会话已经启动的警告(原始页面加载)。


选中以确保所有请求都使用相同的会话,

,它是(根据session_id)。


任何帮助表示赞赏。

_SESSION variable back after it sets it, and it sets it
properly. But the subsequent request doesn''t see it.

I can''t figure this one out, and this sort of function is vital to the
site I''m building.

Things I''ve already done:

Put session_start() in the functions that get called after the initial
pageload. Just generates warnings that a session has already been
started (by the original pageload).

Checked to make sure the same session is being used by all requests,
and it is (according to session_id).

Any help is appreciated.

Evil Otto写道:
Evil Otto wrote:

我的页面加载,并调用一个init()函数将内容返回到

div页面,以及设置
My page loads, and calls an init() function that returns content to a
div on the page, as well as setting a


这篇关于无法读取前一个请求AJAX设置的$ _SESSION变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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