Permalink
Browse files

Work on third calculator and other things

  • Loading branch information...
1 parent 10da097 commit 3752eb15864a5535754c5ebf79f76348fccec49c @Guest007 committed Feb 24, 2014
Showing with 30 additions and 27 deletions.
  1. +29 −2 templates/layout.html
  2. +1 −25 theme/js/init.js
View
@@ -26,15 +26,42 @@
<a href="#">Заказать обратный звонок
</a>
- <form id="call_back" class="call hide" method="post" action="/call-back/">
- <span>Заказ звонка<small><i class="fa fa-times"></i></small></span>
+ <form class="call hide" method="post" action="/call-back/">
+ <span>Заказ звонка<small class="close_form"><i class="fa fa-times"></i></small></span>
<small><i class="fa fa-asterisk"></i></small>
<input type="text" name="fio" placeholder="ФИО">
<small class="phone"><i class="fa fa-asterisk"></i></small>
<input type="text" name="phone" placeholder="Телефон">
<textarea name="message" placeholder="Сообщение"></textarea>
<input type="submit" value="Отправить">
</form>
+ <script>
+ function call_() {
+ var self = $('form.call');
+ $('.location > a').click(function(){
+ self.removeClass('hide');
+ return false;
+ });
+ self.find('.close_form').click(function(){
+ self.addClass('hide');
+ });
+ self.submit(function(){
+ var action = self.attr('action');
+ console.log(action);
+ $.ajax({
+ url: action,
+ type: 'POST',
+ data: self.serialize(),
+ complete: function(result){
+ self.trigger( 'reset' );
+ self.addClass('hide');
+ }
+ });
+ return false;
+ });
+ }
+ call_();
+ </script>
</section>
<nav>
View
@@ -597,31 +597,7 @@ $(document).ready(function(){
news_title_height();
//Обратный звонок
- function call_() {
- var self = $('form.call');
- $('.location > a').click(function(){
- self.removeClass('hide');
- return false;
- });
- $('form.call > span > small').click(function(){
- self.addClass('hide');
- });
- self.submit(function(){
- var action = $(this).attr('action');
- var that = $(this);
- $.ajax({
- url: action,
- type: 'POST',
- data: that.serialize(),
- complete: function(result){
- $('#call_back').trigger( 'reset' );
- $('#call_back').addClass('hide');
- }
- });
- return false;
- });
- }
- call_();
+
$('.location > a').click(function(){
$(this).siblings('form').removeClass('hide');

0 comments on commit 3752eb1

Please sign in to comment.