Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     $(function () {
  2.  
  3.         $("#fastorder input,#fastorder textarea").jqBootstrapValidation(
  4.             {
  5.                 preventSubmit: true,
  6.                 submitSuccess: function ($form, event) {
  7.                     event.preventDefault();
  8.                     var foproduct = $("input#foproduct").val();
  9.                     var foproductid = $("input#foprouctid").val();
  10.                     var name = $("input#name").val();
  11.                     var email = $("input#email").val();
  12.                     var phone = $("input#phone").val();
  13.                     var message = $("textarea#message").val();
  14.                     var firstName = name;
  15.                     if (firstName.indexOf(' ') >= 0) {
  16.                         firstName = name.split(' ').slice(0, -1).join(' ');
  17.                     }
  18.                     $.ajax({
  19.                         url: "index.php?route=product/product/fastorder",
  20.                         type: "POST",
  21.                         data: {
  22.                             foproduct: foproduct,
  23.                             foproductid: foproductid,
  24.                             name: name,
  25.                             email: email,
  26.                             phone: phone,
  27.                             message: message
  28.                         },
  29.                         dataType: 'json',
  30.                         cache: false,
  31.                         success: function (json) {
  32.                             if (json['success']) {
  33.                                 $('#success').html("<div class='alert alert-success'>");
  34.                                 $('#success > .alert-success').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;")
  35.                                     .append("</button>");
  36.                                 $('#success > .alert-success')
  37.                                     .append("<?php echo $entry_fo_send_success; ?>");
  38.                                 $('#success > .alert-success')
  39.                                     .append('</div>');
  40.  
  41.                                 dataLayer.push({
  42.                                     "event":"ua-event",
  43.                                     "eventCategory":"zakaz",
  44.                                     "eventAction":"send"
  45.                                 });
  46.  
  47.                          //       $('#contactForm').trigger("reset");
  48.                             } else {
  49.                                 $('#success').html("<div class='alert alert-danger'>");
  50.                                 $('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;")
  51.                                     .append("</button>");
  52.                                 $('#success > .alert-danger').append("<?php echo $entry_fo_send_error; ?>");
  53.                                 $('#success > .alert-danger').append('</div>');
  54.                             }
  55.                         },
  56.                         error: function () {
  57.                             $('#success').html("<div class='alert alert-danger'>");
  58.                             $('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;")
  59.                                 .append("</button>");
  60.                             $('#success > .alert-danger').append("<?php echo $entry_fo_send_error; ?>");
  61.                             $('#success > .alert-danger').append('</div>');
  62.                         }
  63.                     })
  64.                 },
  65.                 filter: function () {
  66.                     return $(this).is(":visible");
  67.                 }
  68.             });
  69.  
  70.         $("a[data-toggle=\"tab\"]").click(function (e) {
  71.             e.preventDefault();
  72.             $(this).tab("show");
  73.         });
  74.     });
  75.     $(function () {
  76.         $.mask.definitions['x'] = '[0-9]';
  77.         $('.telephone_form').mask("<?php echo $config_telephone_mask; ?>", {placeholder: "_"});
  78.     });
  79.  
  80.     /*When clicking on Full hide fail/success boxes */
  81.     $('#name').focus(function () {
  82.         $('#success').html('');
  83.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement