Answers for "submit current form jquery"

20

jquery submit form

// It is simply
$('form').submit();

// However, you're most likely wanting to operate on the form data
// So you will have to do something like the following...
$('form').submit(function(e){
	// Stop the form submitting
  	e.preventDefault();
  	// Do whatever it is you wish to do
  	//...
  	// Now submit it 
    // Don't use $(this).submit() FFS!
  	// You'll never leave this function & smash the call stack! :D
  	e.currentTarget.submit();
});
Posted by: Guest on April-05-2020
0

jquery on form submit call function

$(document).ready(function() {
  $("your form selector here").submit(function() {


    // do the extra stuff here
    $.ajax({
     type: "POST",
      url: "mail.php",
      data: $(this).serialize(),
      success: function() {
        $('.simple-sucess').fadeIn(100).show();
        $('.contact_form').fadeOut(100).hide();
        $('.simple_error').fadeOut(100).hide();

       }
    })

  })
})
Posted by: Guest on December-08-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language