Reputation: 8882
I have a form that I'm submitting using jQuery $.post()
. It doesn't submit any variables.
Here's the jQuery code:
$('#eb1').live('click',function() {
$.post("php/emailPost.php", $("emailPost").serialize(), function(){
$("#emailModal").dialog('close');
$('#emailJQButton').attr('value', 'Emailed');
});
});
The post file returns no errors, and everything else is working fine. It's only the fact that no values are passed (I checked with Firebug).
Here's a portion of the PHP code outputting the form itself (don't say anything about HEREDOC, it does not work for me, case closed):
echo "<form action='php/emailPost.php' method='POST' class='inline' id='emailPost'>";
echo "<input type='hidden' value='" . $_SESSION["email"] . "' name='emailAddress'>";
echo "<input type='button' value='Email To Me' id='eb1'/>";
echo "<input type='hidden' name='passedCoupID' value='" . $coupID . "'/>";
echo "</form>";
I don't see anything obvious why it doesn't pass any values. Other similarly-written forms pass variables correctly. $coupID
is pre-populated by the page.
Any help?
Upvotes: 0
Views: 385
Reputation: 1402
change
$("emailPost").serialize()
to $("#emailPost").serialize()
or $("form").serialize()
Upvotes: 2