Skip to content

Commit

Permalink
v.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
DimkaSklyar committed Apr 27, 2018
1 parent 5ddde8e commit 8d3ff83
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 48 deletions.
Binary file modified dist/img/footer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
<div class="col-xl-4 col-md-6 col-lg-5 col-sm-9">
<div class="order">
<p class="order-header">Оставить заявку</p>
<form action="" method="post" id="form-order">
<form method="POST" id="form-order">
<input type="text" name="name" id="name" placeholder="Имя" required>
<input type="text" name="phone" id="phone" placeholder="Телефон" required>
<select name="auto" id="auto">
Expand All @@ -122,7 +122,7 @@
<textarea name="comment" id="comment" cols="30" rows="5" placeholder="Дополнительная информация..."></textarea>
</form>
<div id="messegeResult-order">
<button id="submit-form-z" type="submit" form="form-order" class="btn btn-darken" onclick="AjaxFormRequest('messegeResult-order', 'form-order', './order.php')">Отправить</button>
<button id="submit-form-z" type="submit" form="form-order" class="btn btn-darken">Отправить</button>
</div>
</div>
</div>
Expand Down Expand Up @@ -372,7 +372,7 @@ <h2 class="section-name-03">Часто задаваемые вопросы</h2>
<input type="email" name="q-mail" id="q-mail" placeholder="Email" required>
<textarea name="question-q" id="question-q" rows="5" placeholder="Вопрос?" required></textarea>
<div id="messegeResult-ques">
<button type="submit" form="question-form" class="btn btn-darken" onclick="AjaxFormRequest('messegeResult-ques', 'question-form', './question.php')" >Отправить</button>
<button type="submit" form="question-form" class="btn btn-darken" >Отправить</button>
</div>
</form>
<!-- form itself -->
Expand Down Expand Up @@ -484,7 +484,7 @@ <h2 class="section-name-06">Специалисты</h2>
<input type="email" name="e-mail" id="e-mail" placeholder="Введите свою электронную почту" required>
</form>
<div id="messegeResult-sub">
<button id="submit-form-p" type="submit" form="mailyes" class="btn btn-darken" onclick="AjaxFormRequest('messegeResult-sub', 'mailyes', './subscribe.php')">Отправить</button>
<button id="submit-form-p" type="submit" form="mailyes" class="btn btn-darken">Отправить</button>
</div>
</div>
<div class="col-xl-4 col-lg-5">
Expand Down
26 changes: 19 additions & 7 deletions dist/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,33 @@ $(document).ready(function() {

});

$('#form-order').submit(function(e){
e.preventDefault();
AjaxFormRequest('messegeResult-order','form-order','./order.php');
});

$('#question-form').submit(function(e){
e.preventDefault();
AjaxFormRequest('messegeResult-ques','question-form','./question.php');
});

$('#mailyes').submit(function(e){
e.preventDefault();
AjaxFormRequest('messegeResult-sub','mailyes','./subscribe.php');
});
function AjaxFormRequest(result_id,formMain,url) {
if ($('#'+formMain).find('input').val() != ''){
jQuery.ajax({
url: url,
type: "POST",
dataType: "html",
data: jQuery("#"+formMain).serialize(),
success: function(response) {
document.getElementById(result_id).innerHTML = response;
$(':input','#'+formMain)
.not(':button, :submit, :reset, :hidden')
.val('')
.removeAttr('checked')
.removeAttr('selected');
},
error: function(response) {
$('.m-0').remove();
Expand All @@ -202,12 +220,6 @@ function AjaxFormRequest(result_id,formMain,url) {
}
}
});
}
// jQuery(':input','#'+formMain)
// .not(':button, :submit, :reset, :hidden')
// .val('')
// .removeAttr('checked')
// .removeAttr('selected');
}


Expand Down
26 changes: 19 additions & 7 deletions dist/js/scripts.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Марка авто: <span style="font-weight:bold;color:#339900;">'.$_POST['auto'].'</span><br>
Комментарий: <span style="font-weight:bold;color:#339900;font-size:24px;"> '.$_POST['comment'].'</span>';
$headers = "Content-type: text/html; charset=UTF-8 \r\n";
$headers .= "From: <info@my-site.ru\r\n"; // от кого, придумайте ящик или укажите почту своего сайта.
$headers .= "From: info@my-site.ru\r\n"; // от кого, придумайте ящик или укажите почту своего сайта.
$result = mail($to, $subject, $message, $headers);

if ($result){
Expand Down
4 changes: 2 additions & 2 deletions dist/question.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
$message = '<span style="font-weight:bold;color:#ff6600;font-size:18px;"><i>ВОПРОС!</i> </span><br><br>
Имя: <span style="font-weight:bold;color:#000;">'.$_POST['q-name'].'</span><br>
E-mail: <span style="font-weight:bold;color:#339900;">'.$_POST['q-mail'].'</span><br>
Вопрос: <span style="font-weight:bold;color:#339900;font-size:24px;"> '.$_POST['question'].'</span>';
Вопрос: <span style="font-weight:bold;color:#339900;font-size:24px;"> '.$_POST['question-q'].'</span>';
$headers = "Content-type: text/html; charset=UTF-8 \r\n";
$headers .= "From: <info@my-site.ru\r\n"; // от кого, придумайте ящик или укажите почту своего сайта.
$headers .= "From: info@my-site.ru\r\n"; // от кого, придумайте ящик или укажите почту своего сайта.
$result = mail($to, $subject, $message, $headers);

if ($result){
Expand Down
7 changes: 4 additions & 3 deletions dist/subscribe.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
$message = '<span style="font-weight:bold;color:#ff6600;font-size:18px;"><i>ПОДПИСКА!</i> </span><br><br>
E-mail: <span style="font-weight:bold;color:#339900;font-size:24px;"> '.$_POST['e-mail'].'</span>';
$headers = "Content-type: text/html; charset=UTF-8 \r\n";
$headers .= "From: <info@my-site.ru\r\n"; // от кого, придумайте ящик или укажите почту своего сайта.
$headers .= "From: info@my-site.ru\r\n"; // от кого, придумайте ящик или укажите почту своего сайта.
$result = mail($to, $subject, $message, $headers);

if ($result){
echo "<p style='text-transform: uppercase;
color: #fff;
font-size: 1em;
background-color: #f3e200;
background-color: #011e9e;
font-weight: 700;
padding: .4em;
padding: .9em;
box-shadow: 0 19px 49px 0px rgba(81,74,48,0.3);
text-align: center;'>Спасибо!</p>";
}
Expand Down
8 changes: 4 additions & 4 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
<div class="col-xl-4 col-md-6 col-lg-5 col-sm-9">
<div class="order">
<p class="order-header">Оставить заявку</p>
<form action="" method="post" id="form-order">
<form method="POST" id="form-order">
<input type="text" name="name" id="name" placeholder="Имя" required>
<input type="text" name="phone" id="phone" placeholder="Телефон" required>
<select name="auto" id="auto">
Expand All @@ -122,7 +122,7 @@
<textarea name="comment" id="comment" cols="30" rows="5" placeholder="Дополнительная информация..."></textarea>
</form>
<div id="messegeResult-order">
<button id="submit-form-z" type="submit" form="form-order" class="btn btn-darken" onclick="AjaxFormRequest('messegeResult-order', 'form-order', './order.php')">Отправить</button>
<button id="submit-form-z" type="submit" form="form-order" class="btn btn-darken">Отправить</button>
</div>
</div>
</div>
Expand Down Expand Up @@ -372,7 +372,7 @@ <h2 class="section-name-03">Часто задаваемые вопросы</h2>
<input type="email" name="q-mail" id="q-mail" placeholder="Email" required>
<textarea name="question-q" id="question-q" rows="5" placeholder="Вопрос?" required></textarea>
<div id="messegeResult-ques">
<button type="submit" form="question-form" class="btn btn-darken" onclick="AjaxFormRequest('messegeResult-ques', 'question-form', './question.php')" >Отправить</button>
<button type="submit" form="question-form" class="btn btn-darken" >Отправить</button>
</div>
</form>
<!-- form itself -->
Expand Down Expand Up @@ -484,7 +484,7 @@ <h2 class="section-name-06">Специалисты</h2>
<input type="email" name="e-mail" id="e-mail" placeholder="Введите свою электронную почту" required>
</form>
<div id="messegeResult-sub">
<button id="submit-form-p" type="submit" form="mailyes" class="btn btn-darken" onclick="AjaxFormRequest('messegeResult-sub', 'mailyes', './subscribe.php')">Отправить</button>
<button id="submit-form-p" type="submit" form="mailyes" class="btn btn-darken">Отправить</button>
</div>
</div>
<div class="col-xl-4 col-lg-5">
Expand Down
26 changes: 19 additions & 7 deletions src/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,33 @@ $(document).ready(function() {

});

$('#form-order').submit(function(e){
e.preventDefault();
AjaxFormRequest('messegeResult-order','form-order','./order.php');
});

$('#question-form').submit(function(e){
e.preventDefault();
AjaxFormRequest('messegeResult-ques','question-form','./question.php');
});

$('#mailyes').submit(function(e){
e.preventDefault();
AjaxFormRequest('messegeResult-sub','mailyes','./subscribe.php');
});
function AjaxFormRequest(result_id,formMain,url) {
if ($('#'+formMain).find('input').val() != ''){
jQuery.ajax({
url: url,
type: "POST",
dataType: "html",
data: jQuery("#"+formMain).serialize(),
success: function(response) {
document.getElementById(result_id).innerHTML = response;
$(':input','#'+formMain)
.not(':button, :submit, :reset, :hidden')
.val('')
.removeAttr('checked')
.removeAttr('selected');
},
error: function(response) {
$('.m-0').remove();
Expand All @@ -202,12 +220,6 @@ function AjaxFormRequest(result_id,formMain,url) {
}
}
});
}
// jQuery(':input','#'+formMain)
// .not(':button, :submit, :reset, :hidden')
// .val('')
// .removeAttr('checked')
// .removeAttr('selected');
}


Expand Down
26 changes: 19 additions & 7 deletions src/js/scripts.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Марка авто: <span style="font-weight:bold;color:#339900;">'.$_POST['auto'].'</span><br>
Комментарий: <span style="font-weight:bold;color:#339900;font-size:24px;"> '.$_POST['comment'].'</span>';
$headers = "Content-type: text/html; charset=UTF-8 \r\n";
$headers .= "From: <info@my-site.ru\r\n"; // от кого, придумайте ящик или укажите почту своего сайта.
$headers .= "From: info@my-site.ru\r\n"; // от кого, придумайте ящик или укажите почту своего сайта.
$result = mail($to, $subject, $message, $headers);

if ($result){
Expand Down
4 changes: 2 additions & 2 deletions src/question.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
$message = '<span style="font-weight:bold;color:#ff6600;font-size:18px;"><i>ВОПРОС!</i> </span><br><br>
Имя: <span style="font-weight:bold;color:#000;">'.$_POST['q-name'].'</span><br>
E-mail: <span style="font-weight:bold;color:#339900;">'.$_POST['q-mail'].'</span><br>
Вопрос: <span style="font-weight:bold;color:#339900;font-size:24px;"> '.$_POST['question'].'</span>';
Вопрос: <span style="font-weight:bold;color:#339900;font-size:24px;"> '.$_POST['question-q'].'</span>';
$headers = "Content-type: text/html; charset=UTF-8 \r\n";
$headers .= "From: <info@my-site.ru\r\n"; // от кого, придумайте ящик или укажите почту своего сайта.
$headers .= "From: info@my-site.ru\r\n"; // от кого, придумайте ящик или укажите почту своего сайта.
$result = mail($to, $subject, $message, $headers);

if ($result){
Expand Down
7 changes: 4 additions & 3 deletions src/subscribe.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
$message = '<span style="font-weight:bold;color:#ff6600;font-size:18px;"><i>ПОДПИСКА!</i> </span><br><br>
E-mail: <span style="font-weight:bold;color:#339900;font-size:24px;"> '.$_POST['e-mail'].'</span>';
$headers = "Content-type: text/html; charset=UTF-8 \r\n";
$headers .= "From: <info@my-site.ru\r\n"; // от кого, придумайте ящик или укажите почту своего сайта.
$headers .= "From: info@my-site.ru\r\n"; // от кого, придумайте ящик или укажите почту своего сайта.
$result = mail($to, $subject, $message, $headers);

if ($result){
echo "<p style='text-transform: uppercase;
color: #fff;
font-size: 1em;
background-color: #f3e200;
background-color: #011e9e;
font-weight: 700;
padding: .4em;
padding: .9em;
box-shadow: 0 19px 49px 0px rgba(81,74,48,0.3);
text-align: center;'>Спасибо!</p>";
}
Expand Down

0 comments on commit 8d3ff83

Please sign in to comment.