dqusbxh44823 2017-02-14 21:38
浏览 35

我正在使用PHP和Jquery以及AJAX,正在将数组发布到php会话

I am trying to post an array with it but for some odd reason the only ones that fully get initialized are the third and zeroth spots.

This is the JS file im working with.

<script type="text/javascript">
    jq("#runTour").click(function(e) {
        //e.preventDefault();
        console.log('true set');
        jq.post(window.location.href + '?event=checkTour',{'initialSet[]': [12, 1, '100', window.location.origin + '/ppwweb/control.php/admin/users', window.location.href, '', true] } )
        .done(function(data){
            return jq(".smallipopTour1").smallipop('tour', 0, 12, 'https://devml.propertypreswizard.com/ppwweb/control.php/admin/users');/*'tour' is a keywor needed, the 0 is the current sstep we are on, 12 is the total steps in the tour, annd the address is for when the tour goes to a new page */ 
        });

    });
    function continueTour1(e) {
    //e.preventDefault()

    return jq('.smallipopTour1').smallipop('tour', 0, 12, "https://devml.propertypreswizard.com/ppwweb/control.php/admin/users", "");
  };
          /* Tour stuff */
    jq('.smallipopTour1').smallipop({
    theme: 'white fat-shadow',
    tourTitle: 'Sample',
    preferredPosition: 'right',
    tourHighlight: false,
    popupOffset: 0,
    triggerOnClick: true
    });

This is the PHP code that i would be posting to.

function checkTourRun (){
    //['on_tour'][0total steps, 1current step, 2steps done, 3Nurl, 4Curl, 5Burl, 6ontour]

    //if(isset($_GET['requested'])) MAYBE
    ob_clean();
    echo '',
        '<pre>';
    print_r($_POST['info']);
    echo '</pre>',
        '';
     if(isset($_POST['initialSet']))
        $_SESSION['on_tour'] = $_POST['initialSet'];

    //echo  'helicopter';
    $pageURL .= 'http';
    if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
        $pageURL .= "://";
    if ($_SERVER["SERVER_PORT"] != "80") {
        $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    } else {
        $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    }

    $_SESSION['on_tour'][6] = $_POST['onTourS'];


    if ($_SESSION['on_tour'][6]) {
        $_SESSION['masterCnt'] = $_POST['masterCntS'];//sets master count               
        $_SESSION['on_tour'][4] = $_POST['Curl'];//sets new Current Url
        $_SESSION['on_tour'][5] = $_POST['Burl'];//sets Back Url
        $_SESSION['on_tour'][2] = $_POST['stepsDone'];//sets the # of steps done
        //$thing = $_SESSION['on_tour'][4];


        if ($_SESSION['on_tour'][4] . "?event=checkTour" === $pageURL) {            
            echo false . '
';
            echo $_SESSION['on_tour'][1] . '
';
            echo $pageURL;

        }
        else if($_SESSION['on_tour'][1] === $_SESSION['on_tour'][2]){

            echo true;
        }

    }
    echo $_SESSION['on_tour'][0] . '   ';//suppose to be 12
    echo $_SESSION['on_tour'][1] . '   ';//suppose to be 1
    echo $_SESSION['on_tour'][4] . '   ';//suppose to be an url

    //echo $pageURL;
    error_log(print_r('SUPPORT', true), 0);
    error_log(print_r($_SESSION, true), 0);
    //echo $_SESSION['on_tour'][1][6];
    exit;
  }
}

My problem comes with that last few lines echoing out the 0th element and the 3rd element are the only ones that display the proper items and i do not know why. I am at my wits end and I really need help, Thanks a lot in advanced.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)