Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Javascript 

Submit button not sending anything

I'm trying to use this custom-built submit button that was made with this website design that I'm using and I don't know how to make the submit button send a POST request with the forms on my page. So far the only thing the button does is make a "Thank you!" show on the webpage. I'm trying to just make a simple POST request submit button.

Here is the code:
Code
//Signup Form.
        (function() {

            // Vars.
                var $form = document.querySelectorAll('#signup-form')[0],
                    $submit = document.querySelectorAll('#signup-form input[type="submit"]')[0],
                    $message;

            // Bail if addEventListener isn't supported.
                if (!('addEventListener' in $form))
                    return;

            // Message.
                $message = document.createElement('span');
                    $message.classList.add('message');
                    $form.appendChild($message);

                $message._show = function(type, text) {

                    $message.innerHTML = text;
                    $message.classList.add(type);
                    $message.classList.add('visible');

                    window.setTimeout(function() {
                        $message._hide();
                    }, 3000);

                };

                $message._hide = function() {
                    $message.classList.remove('visible');
                };

            // Events.
            // Note: If you're *not* using AJAX, get rid of this event listener.
                $form.addEventListener('submit', function(event) {

                    event.stopPropagation();
                    event.preventDefault();

                    // Hide message.
                        $message._hide();

                    // Disable submit.
                        $submit.disabled = true;

                    // Process form.
                    // Note: Doesn't actually do anything yet (other than report back with a "thank you"),
                    // but there's enough here to piece together a working AJAX submission call that does.
                        window.setTimeout(function() {

                            // Reset form.
                                $form.reset();

                            // Enable submit.
                                $submit.disabled = false;

                            // Show message.
                                $message._show('success', 'Thank you!');
                                //$message._show('failure', 'Something went wrong. Please try again.');

                        }, 750);

                });
Look at this part of the code:

Code
// Process form.
            // Note: Doesn't actually do anything yet (other than report back with a "thank you"),
            // but there's enough here to piece together a working AJAX submission call that does.
            window.setTimeout(function() {

            // Reset form.
            $form.reset();

            // Enable submit.
            $submit.disabled = false;

            // Show message.
            $message._show('success', 'Thank you!');
            //$message._show('failure', 'Something went wrong. Please try again.');

             //ADD AJAX POST HERE

            }, 750);
Check out my threads @Mark


Possibly Related Threads...
Thread / Author Replies Views Last Post
[PHP] by QRCodeOct 28, 2018 10:45 AM 6 242 Oct 28, 2018 10:45 AM
Last Post: Abruptum
[PHP] by FaberCastellApr 3, 2018 03:50 AM 7 201 Apr 3, 2018 03:50 AM
Last Post: Nachfolger
[PHP] by RootBlack1996Oct 29, 2017 09:41 AM 14 434 Oct 29, 2017 09:41 AM
Last Post: Charger