开发者

jquery ajax and php session

I have a simple web page that has 3 tabs in my main content area. Once a user clic开发者_JAVA技巧ks on a particular tab, I use jquery and ajax to fetch some data from server and (of course) without reloading everything I change some div below those three tabs.

I use $.post to get data from the server and there are 3 different php files on a server that I call (one for each tab) and get data from.

Is it possible to start a php session when a user clicks on the first tab and save some $_SESSION variables and then use them when a user clicks on the second or third tab so that I know what user clicked on the second or third tab?

Thanks! Newman


Yes, the sessions are shared across all php scripts. So whatever you save in the first tab will be readable on 2nd and 3rd tab. Keep in mind that

Edit: Thing to keep in mind here is that the domain should remain the same for all scripts to be able to see the session.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜