Firefox 未向服务器发送 POST 数据

Firefox not sending POST data to server

我似乎无法向服务器发送任何数据。在我拥有的其他一些页面中,我甚至可以做到这一点。唯一的区别是我使用的是这种特殊形式的文件上传。在 chrome.

中一切正常

哪里出错了?

<script>
        $( document ).ready(function() {
            $("#addnewadform").submit(function(e){
                e.preventDefault();
                $.ajax({
                    cache:false,
                    url: "/call/insert-standart-add.call.php", //URL IS CORRECT
                    type: "post",             // this is OK too
                    data: {submitStandartPost:'im sending the submit button value'}, //this is a super-simplified version of what i want the server to recieve
                    contentType: 'multipart/form-data',//i have tried a ton of different values for this
                    processData: false, //think this should be false for file uploads
                    success: function(data){
                        console.log(data);
                        if(data!==''){
                            console.log(data);
                        }else{
                            console.log("nothing was sent");
                        }
                    }
                });

            });
        });
    </script>

服务器没有收到任何东西,但正在调用脚本本身。

if(isset($_POST['submitStandartPost'])){

}else{
 echo 'no input';
}

可能错误与文件上传无关。我试图删除文件上传和 enctype='multipar/bal bla bal'。只是不工作。没有记录错误

问题是 FireFox 不发送提交输入的值。在 PHP 的 $_POST 中它根本不存在。

至于解决这个问题,我不知道。

我有时讨厌 HTML...

无论如何。避免此问题的最佳方法是明确跨浏览器方式,即不使用 $_POST['submit'] 按钮,因为它不可靠。

所以,例如,不要这样做:

if(isset($_POST['submit'])){
//do my form logic here
}