php - Submit form with ajax problems -
i having issues message form submission. can information send .php file email not sending can me?
here jquery
$('form.contact').on('submit', function() { var = $(this), url = that.attr('action'), type = that.attr('method'), data = {}; that.find('[name]').each(function() { var = $(this); name = that.attr('name'); value = that.val(); data[name] = value; }); $.ajax({ url: url, type: type, data: data, success: function(response) { console.log(response); } }); return false; });
and here php
include 'config.php'; // email submit if (isset($_post['email']) && isset($_post['name']) && isset($_post['message'])){ //send email mail(email_address, "contact form: ".$_post['name'], $_post['message'], "from:" . $_post['email']); }
email_address
constant set admin.
and if needed here html
<div id="contact_form"> <form action="admin/submit.php" method="post" class="contact"> <input class="fullwidth" type="text" name="name" placeholder="your name" /> <input class="fullwidth" type="email" name="email" placeholder="email address" /> <textarea type="text" name="message" placeholder="message"></textarea> <input id="submit" type="submit" value="submit" /> <div id="submit_triangle"></div> </form> </div>
well, code seems fine. have mail server installed on system. check settings of mail server if have it
http://php.net/manual/en/function.mail.php says mail
returns true if mail accepted delivery, false otherwise.
it important note because mail accepted delivery, not mean mail reach intended destination
Comments
Post a Comment