javascript - Submit button not sending anything -
i'm trying use custom-built submit button made website design i'm using , don't know how make submit button send post request forms on page. far thing button make "thank you!" show on webpage. here 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, rid of 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 yet (other report "thank you"), // there's enough here piece working ajax submission call 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); });
you need remove
event.preventdefault();
for more info check http://api.jquery.com/event.preventdefault/
Comments
Post a Comment