My goal is for the user to fill out one form and use JavaScript to post the form into two places and I created this fiddle to that end.
- There is one form with an
input[type='submit']button on it. - When the user submits the form, jQuery intercepts the form, sets a flag, and submits it to the alternate location via AJAX.
- Upon success, the AJAX callback triggers the form to submit again. The JS notices the flag set in (2) and allows the submission to to occur naturally.
The problem is that the second submission never happens. If I click the button a second time, the form does the full POST so that tells me the logic is correct. Is there a restriction on how many times the browser can submit a form per user action? Why isn’t this working?
You can use jQuery ajax() call to submit form to your alternativee location via AJAX, and on success event you could submit it to its original location.
Check out the code: http://jsfiddle.net/M7Bfb/2/