A
A
Andrey Grigorash2016-04-07 01:27:13
PHP
Andrey Grigorash, 2016-04-07 01:27:13

Ajax submitting multiple forms?

There is a tab panel of 5 tabs with 5 forms. It is necessary to scrape all the data on all forms and send it to the server. How to organize data collection.
$('.send').submit(e) {
e.preventDefault();
$.ajax({
type: this.method,
data: $(this).serialize(),
success: function() { /*success*/ },
error: function() { /*submit error*/ },
} );
});
Tried to set all one class. Yes the data from each form come it is possible to tell.
The first form comes, I go to the second tab, enter the data - I send it and the first data is no longer saved, but new ones came and the tab jumped to the first one. How to fix please tell me.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2016-04-07
@germany1992

You can flip it so that all the "tabs" are inside the same form.
Or collect data with javascript (using .serialize() , for example), and then send everything at once.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question