Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.php
- <form>
- <input type="text" class="req" id="ap-form-name" value="имя...">
- <input type="text" class="req" id="ap-form-email" value="email...">
- <textarea class="req" id="ap-form-message">сообщение...</textarea>
- <button type="submit">Отправить</button>
- </p>
- </fieldset>
- <fieldset class="ap-thanks">
- <h1>Спасибо за ваше обращение!</h1>
- <p>Мы обязательно обязательно ответим на него.</p> </fieldset>
- </form>
- <script>
- jQuery('#ap').data('config',
- {
- "email_form":"info@gmail.com",
- })
- </script>
- load.js
- function contact_form() {
- ...
- var _email=book.config['email_form'];
- var dataString = 'name='+ name + '&email=' + email + '&message=' + message+'&_email='+_email;
- $.ajax({
- type: "POST",
- url: "php/submit-form-ajax.php",
- data: dataString,
- success: function(msg) {
- // Check to see if the mail was successfully sent
- if (msg == 'Mail sent') {
- $("#ap-contact fieldset").hide();
- $("#ap-contact fieldset.ap-thanks").show();
- setTimeout(function() {
- close_overlay();
- }, 5000);
- } else {
- $('#ap-contact button').fadeIn('fast');
- alert('The problem with sending it, please try again!');
- }
- },
- error: function(ob,errStr) {
- alert('Problem with sending.');
- }
- });
- return false;
- });
- submit-form-ajax.php
- $name = $_POST["name"];
- $email = $_POST["email"];
- $message = $_POST["message"];
- $msg = "
- Имя: $name
- Email: $email
- Текст сообщения: $message
- ";
- $to = "info@gmail.com";
- $subject = "Сообщение";
- $message = $msg;
- mail($to,$subject,$message,$headers
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement