USing JQuery to get form data

Hey there,

I am using JQuery to get some form data. Here is the html:

<input name=“test2” type=“text” value=“39” size=“32” maxlength=“20” value=“”/>

Here is my Jquery.

var $inputs = $('#details :input');

   var values = {};
    $inputs.each(function() {
        values[this.name] = $(this).val();

    });

$('#checkout').click(function()

 {

    $.ajax({
        type: 'GET',
        url: 'index.php?route=payment/check/confirm',
        data: {id:'test', id2:values['test1'], id3:values['test2'], id4:values['test3']},
        success: function() {
            location = '<?php echo $continue; ?>';
        }
    });
});

If I hardcode a value into the html then my jquery returns and displays it correctly but if I input it manually on the page, it returns nothing.

As you can see it uses Ajax to load another script and if successful, completes the transaction. However, it refuses to accept my manually input values. Is this because I haven’t used a submit button? I haven’t even declared a form action or method because I am using the onclick event handler and using Jquery to get everything from the form. This is not my design, it is the cms system I am working with.

Can anyone suggest a workaround?

[SOLVED]

mY JQuery to select the input values was outside of the click function so I moved it inside and now its fine :wink:

jQuery.serializeArray() is what you should use if your posting form values