首页 > 解决方案 > 查询字符串值在 Javascript 中不起作用

问题描述

你好 stackoverflow 社区,我面临一个问题,我的查询字符串不起作用并且它在 javascript 内部,我使用 isset 和 empty 来测试结果,它一直说失败。这是代码:

events:'load.php?loadfor="$id"',

该代码在一个完整的日历脚本中,我想为特定的人加载一个事件。完整代码:

$(document).on('click', '.click_hire', function(){

    var to_user_id = $(this).data('touserid');
    $id = $(this).data('touserid');

    var calendar = $('#calendar').fullCalendar({
        nextDayThreshold: '23:59:00',
        forceRerenderToDisplay: true,
        disableDragging: true,
        header:{
                left:'prev,next today',
                right:'title',
                center:''
            },
            events:'load.php?loadfor="$id"',
            selectable:true,
            selectHelper:true,
            select: function(start, end, allDay)
            {
                $("#popup").show();
                var start = $.fullCalendar.formatDate(start, "YY-MM-DD HH:mm:ss");
                var end = $.fullCalendar.formatDate(end, "YY-MM-DD HH:mm:ss");
                $.ajax({
                    url:"get.popup.php",
                    method:"POST",
                    data:{start:start, end:end, to_user_id:to_user_id},
                    success:function(data){
                        $('#popup').html(data);
                    }
                })
            }


        });

});

为了测试,我把它放在我的 get.popout.php 上。

if(isset($_GET['loadfor']))
{
    echo "<h1>Success</h1>";
}
else if(empty($_GET['loadfor']))
{
    echo "<h1>Failed</h1>";
}

标签: phpfullcalendarquery-string

解决方案


推荐阅读