dsaxw4201 2015-02-23 09:43
浏览 136

为什么我的phpsessid在2个ajax请求之间发生变化

I use 2 ajax requests to communicate to my other site

first : authenticate to the site
second : get the data base on user authentication

When I create the user session in first request the session is created, but I only get null data when I request the data because user session is lost.

This does not happen if I test it by manually filling in the url address in browser.

I see the phpssid is changed : phpsessid

ajax request :

var url = 'https://xxx.mysite.co.id/index.php/';
$(document).ready(function(){
    $.ajax({
        url: url+"main/authenticate_user/user/123456/undefined/11",
        dataType : 'json',
        beforeSend: function(xhr){
           xhr.withCredentials = true;
        },
        success: function(authenticate){
            if(authenticate.state == 'success'){
                $.ajax({
                    url: authenticate.url,
                    dataType : 'text',
                    beforeSend: function(xhr){
                       xhr.withCredentials = true;
                    },
                    success: function(login){
                        $.ajax({
                            url: url+"main/module/lead/get_data/lead_id/LEAD26016",
                            dataType : 'json',
                            beforeSend: function(xhr){
                               xhr.withCredentials = true;
                            },
                            success: function(lead){
                                $.ajax({
                                    url: authenticate.url,
                                    dataType : 'text',
                                    beforeSend: function(xhr){
                                       xhr.withCredentials = true;
                                    },
                                    success: function(login){
                                        $.ajax({
                                            url: url+"main/module/lead/get_data/lead_id/LEAD26016",
                                            dataType : 'json',
                                            beforeSend: function(xhr){
                                               xhr.withCredentials = true;
                                            },
                                            success: function(lead){
                                            }
                                        });

                                    }
                                });
                            }
                        });

                    }
                });
            }
        }
    });
});

i request from hxxp://localhost/

Updated : i really stuck for this problem, i just change the session process to my own filecache class.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 软件工程用例图的建立(相关搜索:软件工程用例图|画图)
    • ¥15 如何在arcgis中导出拓扑关系表
    • ¥15 处理数据集文本挖掘代码
    • ¥15 matlab2017
    • ¥15 在vxWorks下TCP/IP编程,总是connect()报错,连接服务器失败: errno = 0x41
    • ¥15 AnolisOs7.9如何安装 Qt_5.14.2的运行库
    • ¥20 求:怎么实现qt与pcie通信
    • ¥50 前后端数据顺序不一致问题,如何解决?(相关搜索:数据结构)
    • ¥15 基于蒙特卡罗法的中介效应点估计代码
    • ¥15 罗技G293和UE5.3