Php – issue with jquery .post() not working

jqueryphppost

so I am new to using jquery .post() however I am not using methods i haven't already used before.

I am trying to post two hidden input values when a button is clicked:

$('#button').live('click', function() {
    $.post('export_file.php', { group: form.group.value , test: form.test.value },
    function(output)    {
        $('#return').html(output).show();
    });
});

i have tested the button event is firing successfully and currently all I trying to do in export_file.php is echo something.

here is my form:

<form name="form">
<input type="hidden" name="group" value="<?echo $group;?>">
<input type="hidden" name="test" value="<?echo $test_id;?>">
<input type="button" class="Mybutton" id="button" name="btnSubmit" value="Export Results">
</form>

i have got my div on the original page:

<div id='return'></div>

export_file.php:

<?php

echo "whatever, something!";

?>

Could anyone point out where I am going wrong. Many thanks,

Best Solution

Try:

$('#button').live('click', function() {
    $.post('export_file.php', { group: $("input[name='group']").val() , test: $("input[name='test']").val() },
    function(output)    {
        $('#return').html(output).show();
    });
});