Last active
June 6, 2016 13:31
-
-
Save pvolyntsev/b1ce3d17c5fad20bffe3 to your computer and use it in GitHub Desktop.
Revisions
-
pvolyntsev revised this gist
Jun 6, 2016 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,10 +4,10 @@ -- [ [webmentor.pro](http://webmentor.pro/) ] + Наставник и ментор по веб-технологиям + Помощь в изучении веб-технологий + Ревью кода Javascript Python NodeJS PHP HTML + Консультации по проектированию и реализации веб-проектов + Разработка индивидуальных планов самостоятельного изучения + Передача навыков удалённой работы + Передача навыков командной веб-разработки -
pvolyntsev revised this gist
Jun 6, 2016 . 1 changed file with 8 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,4 +3,11 @@ Для вопроса https://toster.ru/q/298504 -- [ [webmentor.pro](http://webmentor.pro/) ] Наставник и ментор по веб-технологиям Помощь в изучении веб-технологий Ревью кода Javascript Python NodeJS PHP HTML Консультации по проектированию и реализации веб-проектов Разработка индивидуальных планов самостоятельного изучения Передача навыков удалённой работы Передача навыков командной веб-разработки -
pvolyntsev revised this gist
Jun 6, 2016 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,4 +2,5 @@ Для вопроса https://toster.ru/q/298504 -- Веб-ментор, наставник [ [webmentor.pro](http://webmentor.pro/) ] -
pvolyntsev revised this gist
Jun 6, 2016 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ # Пример кода, реализующего отправку email с сайта через AJAX запрос Для вопроса https://toster.ru/q/298504 Веб-ментор, наставник [ (webmentor.pro)[http://webmentor.pro/] ] -
pvolyntsev revised this gist
Mar 5, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ $(document).ready(function(){ }); function feedback_validate() { var result = true; var f_names = ["#name-input", "#email-input", "#phone-input"]; var el; -
pvolyntsev created this gist
Mar 5, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ <div class="b-form-wrap"> <p id="validation-fail-msg">Please, fill in the missing fields.</p> <form novalidate id="feedback-form"> <div class="b-form-box"> <p class="form-box__text form-box__text_no-pad">What's your name?<sup class="form-box__sup">*</sup></p> <input type="text" name="name" maxlength="30" required id="name-input" class="form-box__input-field"> <p class="form-box__text">What's your phone number?<sup class="form-box__sup">*</sup></p> <input type="text" name="phone" maxlength="30" required id="phone-input" class="form-box__input-field"> <p class="form-box__text">What's your email?<sup class="form-box__sup">*</sup></p> <input type="text" name="email" maxlength="50" required id="email-input" class="form-box__input-field"> </div> <div class="b-form-box b-form-box_left-mrg"> <p class="form-box__text form-box__text_no-pad">How can I help you?</p> <textarea name="text" class="form-box__input-field form-box__input-field_textarea"></textarea> </div> <input type="submit" class="form-box__button" value="Beautify me"><!-- <input type="submit" > вместо <button> --> <p id="validation-success-msg">Thanx, I'll contact you very soon.</p> </form> </div> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ $(document).ready(function(){ $("#feedback-form").submit(function(e){ // привязать обработку на submit а не на click e.preventDefault(); if (feedback_validate()){ $.ajax({ type: "POST", url: "php/feedback.php", data: $(this).serialize() }).done(function() { $(this).find("input").val(""); $('#validation-success-msg').show('fast'); $("html, body").animate({ scrollTop: $(document).height() }, "slow"); $("#feedback-form").trigger("reset"); }); } return false; }); }); function feedback_validate() { var result = false; // по умолчанию форма должна считаться невалидной var f_names = ["#name-input", "#email-input", "#phone-input"]; var el; f_names.forEach(function(item) { el = $(item); if (el.val() == "") { result = false; el.addClass("validation-error"); } else { el.removeClass("validation-error"); } }); if (result) { $("#validation-fail-msg").hide(); } else { $("#validation-fail-msg").show(); $('html, body').animate({ scrollTop: $("#validation-fail-msg").offset().top }, 1000); } return result; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ $recepient = "email here"; $sitename = "site here"; $name = trim($_POST["name"]); $phone = trim($_POST["phone"]); $email = trim($_POST["email"]); $text = trim($_POST["text"]); $subject = "A new submission from \"$sitename\""; $message = "Name: $name \nPhone number: $phone \nEmail: $email \nText: $text"; $headers = array( "Content-type: text/plain; charset=\"utf-8\"", "From: $recepient", "Reply-To: $email", // чтобы при попытке ответить на письмо был подставлен адрес пользователя ); mail($recepient, $subject, $message, implode("\r\n", $headers));