Menu icon Foundation
How I can send my form using Abide and Ajax?

I need to send my form (Google form) via ajax using Abide Plugin and if it is sent, redirect to the Thank's page. I have tried many variants and it is not working. Because it is redirecting me to the form page.

$('#registration_form')
            .on('valid', function (e) {
                e.preventDefault();

                var form = $(this);
                var data = form.serialize();

                console.log(data);

                function redirect() {
                    window.location = 'success.html'
                }

                $.ajax({
                    url: 'https://docs.google.com/forms/d/e/myFormId/formResponse',
                    data: data,
                    type: 'POST',
                    dataType: 'xml',
                    beforeSend: function () {
                        form.find('button').attr('disabled');
                    },
                    statusCode: {
                        0: function () {
                            redirect();
                        },
                        200: function () {
                            redirect();
                        }
                    }
                });


            });

AbleformAJAX

I need to send my form (Google form) via ajax using Abide Plugin and if it is sent, redirect to the Thank's page. I have tried many variants and it is not working. Because it is redirecting me to the form page.

$('#registration_form')
            .on('valid', function (e) {
                e.preventDefault();

                var form = $(this);
                var data = form.serialize();

                console.log(data);

                function redirect() {
                    window.location = 'success.html'
                }

                $.ajax({
                    url: 'https://docs.google.com/forms/d/e/myFormId/formResponse',
                    data: data,
                    type: 'POST',
                    dataType: 'xml',
                    beforeSend: function () {
                        form.find('button').attr('disabled');
                    },
                    statusCode: {
                        0: function () {
                            redirect();
                        },
                        200: function () {
                            redirect();
                        }
                    }
                });


            });