在javascript if语句中取消设置$ _POST

时间:2016-03-24 23:10:56

标签: javascript php jquery ajax http-post

我需要取消设置$ _POST ['u'],但只在javascript函数中,现在$ _POST ARRAY在页面准备好后自动取消设置...

function resetChat(cod_c){
            if(confirm('are you sure?')){

                if (sendReq.readyState == 4 || sendReq.readyState == 0) {
                    sendReq.open("POST", 'getChat.php?chat='+cod_c+'&last=' + lastMessage, true);
                    sendReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
                    sendReq.onreadystatechange = handleResetChat; 
                    var param = 'action=reset';
                    param += '&user=' + document.getElementById('cod_user').value;
                    sendReq.send(param);
                    document.getElementById('txt_message').value = '';

                }
            <?php  unset($_POST['u']); ?>  // this only 1 time after confirm???
            }                       
        }
function handleResetChat() {
        }   

1 个答案:

答案 0 :(得分:1)

PHP是服务器端语言,JavaScript在客户端:)您需要了解有关webdev的更多信息;)