elclanrs / jq-idealforms-old

The ultimate framework for building and validating responsive HTML5 forms.
665 stars 95 forks source link

I cant submit the form by post method #42

Closed devMlGUE closed 12 years ago

devMlGUE commented 12 years ago

I need to submit the form by POST method but the guide doesn't say anything about how i can do that. I try to add the method param to the form but it still not work:

it looks like submit by GET method.
elclanrs commented 12 years ago

If you add method and action to the form it should work on submit if all fields are valid. By default you'll get an alert message from the onSuccess option and then the post request will execute.

<form action="process.php" method="post"></form>

But since you're using jQuery you can use AJAX which is more convenient. Add this to the onSuccess option when you call the plugin on your form.

onSuccess: function() {
  $.post('yourfile.php', $myform.serialize())
}
ghost commented 11 years ago

The page with the form still refreshes in this case? How can we avoid this?