如何使用sweetalert

时间:2018-11-03 20:56:48

标签: javascript php ajax variables sweetalert2

我有一个简短的问题,我想使用Sweet Alert 2'链接模式(队列)。我有2张照片和1条文字。 现在,我想使用AJAX将结果传递到我的数据库中……我尝试过:

      swal.mixin({
                input: 'text',
                confirmButtonText: 'Next →',
                showCancelButton: true,
                progressSteps: ['1', '2', '3']
            }).queue([
                {
                    input: 'file',
                    title: 'Profilbild hochladen',
                    text: 'Empfohlen wird 1X1'
                },
                {
                    input: 'file',
                    title: 'Hintergrundbild hochladen',
                    text: 'Empfohlen wird 16X9'
                },
                {

                    title: 'Über mich',
                    text: ''
                },

            ]).then((result) => {
                if (result.value) {

                    var bild = result[0];
                    var bild2 = result[1];
                    var post = result[2];

                        $.ajax({ type: "POST",  url: "../../register/profil_update.php", data: {"post": post,"bild": bild,"bild2": bild2, "kuerzel": kuerzeltest, "channel": channeltest},

                        });
                        swal(
                            "Super!",
                            "Dein Profil wurde erfolgreich aktualisiert ",
                            "success"

                        )
                    }
            })

可惜的是,它不起作用,谁知道我该如何传递单独的贵重物品?还是我需要传递数组并在PHP中“分离”它?

亲切的问候

莫里兹

0 个答案:

没有答案
相关问题