user1822193
user1822193

Reputation: 49

Can't seem to $post and let PHP sent email

I am trying to refer to an PHP script to send us an e-mail, when someone fills out this #form. This script on page must validate two fields, if correct it must $post and seek for this subscribe.php to post these two fields and send us an e-mail.

here it is what I think is correct (not whole script posted, because it works only can't seem to let $post work)

$('#submit').click(function()
{
var name=$("#name").val();
var device=$("#device").val();
if(ck_name.test(name) && ck_device.test(device) )
{
$.post("http://domain.com/ajax/subscribe.php"),
$("#form").show().html("<h3>Thank you!</h3>");
}
else
{

}
return false;

});

Any help will appreciated. I tried a lot, but somehow the PHP to send e-mail wont be seeked.

Or do you guys advise to submit fields to Database? If yes, what string/function do I have to put into this script above in order to seek for config.php and submit fields to database?

Upvotes: 0

Views: 60

Answers (1)

Jak S
Jak S

Reputation: 669

You haven't provided any data to $.post so the PHP script is not getting any information.

Try something like $.post("http://domain.com/ajax/subscribe.php", $("#form").serialize());

More information available here

Upvotes: 1

Related Questions