douzhechi2435 2011-09-15 05:29
浏览 25

AJAX请求响应在SESSION数据内容上有所不同

I'm using a bookmarklet to post content to a new page on a separate domain. When I set a session variable, like

session_start();
$_SESSION["iamset"] = "true";

on a page, say http://www.mydomain.com/settrue.php, and I echo the result on http://www.mydomain.com/amiset.php like so:

session_start();
echo $_SESSION["iamset"];

when I visit that page in a browser, I can verify that $_SESSION["iamset"] is indeed "true". But when I make an AJAX request to it from a separate page that isn't on the domain, $_SESSION["iamset"] is not "true". What is it about the AJAX request that makes it fail? I read somewhere that AJAX requests are exactly the same as HTTP requests, so I figure it's an issue with the cross-domain access. My PHP does have the header:

header("Access-Control-Allow-Origin: *");

Thanks!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Oracle触发器记录修改前后的字段值
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器