在ajax中的ajax POST没有做任何事情 [英] ajax POST in ajax succes not doing anything

查看:62
本文介绍了在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)

这篇关于在ajax中的ajax POST没有做任何事情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆