samedi 16 juillet 2016

jQuery sweetalert2 function does not

This worked just fine with the original sweetalert, but with sweetalert2 it never runs the function to reload my ajax data.

Can anyone see an error?

         .on('click', '#saveRider', function (e) {
            e.preventDefault();
            $.ajax({
                url: 'ajax/saveRiderClass.php',
                dataType: 'JSON',
                type: 'POST',
                data: $('#addRidersForm').serialize(),
                success: function (json) {
                    if (json && json.status && json.already_entered === false) {
                        swal({
                                title: "Rider Saved and Classes Added!",
                                type: "success"
                            },
                            function (isConfirm) {
                                if (isConfirm === true) {
                                    $("#enteredRiders").load("ajax/getEnteredRiders.php");
                                    $("#uniqueRiders").load("ajax/getUniqueRiders.php");
                                    $("#totalRiders").load("ajax/getTotalEntries.php");
                                }
                            });
                    }
                    else if (json && json.status && json.already_entered === true) {
                        swal({
                            title: "Rider already entered in that class",
                            type: "warning"
                        });
                    }
                }
            });
        })

Aucun commentaire:

Enregistrer un commentaire