getButterfly Logo getButterfly

What’s this all about? I need to get all form data and save it in a hidden input field. I want to use it on a second form on the same page.

    $('.form-paypal').submit(function(event) {

function saveValues() {
    var fields = $(':input').serializeArray();
    jQuery.each(fields, function(i, field) {
        $('#results').append( + ':' + field.value + '|');

I also had a hidden div to collect everything:

<div id="results" style="display:none;"></div>

That’s it. Now I can submit the second form and use the details in the first form.

Subscribe to getButterfly Blog

Once a week or so we send an email with our best content. We never bug you, we just send you our latest piece of content.

If you found any value in this post, agree, disagree, or have anything to add - please do. I use comments as my #1 signal for what to write about. Read our comment policy before commenting! Comments such as "Thank you!", "Awesome!", "You're the man!" are either marked as spam or stripped from URL.

Leave a Reply

Your email address will not be published. Required fields are marked *