简体   繁体   English

PHP无法取消设置会话变量

[英]PHP cannot unset session variable

I cannot unset a session variable used on a search filter. 我无法取消设置在搜索过滤器上使用的会话变量。 When clicking domain.com/index.php?filter=clear nothing happens and the filter is not cleared. 单击domain.com/index.php?filter=clear时,没有任何反应,并且未清除过滤器。

I am using a mixture of php and JS to update the table using AJAX 我正在使用php和JS的混合物来使用AJAX更新表

PHP: PHP:

/**
 * Clears the current filter
 */
function clear()
{
    unset($_SESSION['filter']);

    // Clear current page
    unset($_SESSION['arctic_page']);
}

} }

JS: JS:

clear: function()
{
    // Show loading image
    new Element('img', { src: '/images/loading.gif' }).setStyle('float', 'right').injectTop(Issues.container.getElement('h2'));

    // Create AJAX request
    new Ajax('index.php',
    {
        method: 'get',
        data: 'ajax=true&filter=clear',
        update: 'issue_list',
        onComplete: Issues.initialise
    }).request();
}

It looks like prototype JS, correct? 看起来像JS原型,对吗? It's been a while for me, but I thought this was the correct syntax: 对我来说已经有一段时间了,但是我认为这是正确的语法:

new Ajax.Request('index.php',
{
    method: 'get',
    data: 'ajax=true&filter=clear',
    update: 'issue_list',
    onComplete: Issues.initialise
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM