How can I get the form data if the form is submitted with jQuery submit()
function?
For example
<form action="<?=$PHP_SELF;?>" method="post" id="someForm">
Name: <input type="text" name="name" id="name" /><br />
Email: <input type="text" name="email" id="email" /><br />
</form>
Which I submit with jQuery 开发者_Go百科like:
$("#someForm").submit();
How can I get receive the fields name and email if the form is submitted? Thanks
Just use $('#name').val()
and $('#email').val()
in the submit callback(
$('#form').submit(function() {
alert($('#name').val());
});
for example)
You can do it in this way:
$_POST["name"]
$_POST["email"]
You can get fields by their names. Hope I made it clear.
精彩评论