在ajax中的ajax POST没有做任何事情

问题描述:

我有一个按钮,用户可以点击该按钮然后将触发ajax调用,当它成功时,我想触发另一个ajax调用。
我试过这样:

I've got a button on which the user can click which then will fire an ajax call and when it is succes I want to fire another ajax call. I've tried it like this:

 $.ajax({
            method: "POST",
            url: 'send_confirm.php',
            data: {
                f_name: f_name, 
                l_name: l_name,
                email: email,
                bedrijf: bedrijf,
                first: first,
                second: second,
                third: third,
                fourth: fourth
            },
            success: function(res) {
                $.ajax({
                    method: "POST",
                    url: 'send_mail.php',
                    data2 :{
                        name: name,
                        email: email,
                        first: first,
                        second: second,
                        third: third,
                        fourth: fourth
                    },
                    succes: function(res){
                        console.log(res);
                    }
                });

            }
        });

第一个ajax调用会返回成功,因为当我 console.log(res )它确实返回 json_encode
但在console.log /之后我删除了console.log。 SECOND ajax调用不会激活(我认为?它没有显示在console.log中导航到.. 并且页面保持不变/没有回调或其他任何内容)

The first ajax call DOES return succes because when I console.log(res) it does return the json_encode but after the console.log / when i've removed the console.log. The SECOND ajax call wont fire (I think? It doesn't show Navigated to.. in the console.log and the page remains the same / no callback or anything)

您应该将回调称为成功而不是成功(根据您附加的代码,它只是一个印刷错误)

You should call the callback as "success" and not "succes" (according to the code you attached it's just a misprint)