Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function () {
- $("#fastorder input,#fastorder textarea").jqBootstrapValidation(
- {
- preventSubmit: true,
- submitSuccess: function ($form, event) {
- event.preventDefault();
- var foproduct = $("input#foproduct").val();
- var foproductid = $("input#foprouctid").val();
- var name = $("input#name").val();
- var email = $("input#email").val();
- var phone = $("input#phone").val();
- var message = $("textarea#message").val();
- var firstName = name;
- if (firstName.indexOf(' ') >= 0) {
- firstName = name.split(' ').slice(0, -1).join(' ');
- }
- $.ajax({
- url: "index.php?route=product/product/fastorder",
- type: "POST",
- data: {
- foproduct: foproduct,
- foproductid: foproductid,
- name: name,
- email: email,
- phone: phone,
- message: message
- },
- dataType: 'json',
- cache: false,
- success: function (json) {
- if (json['success']) {
- $('#success').html("<div class='alert alert-success'>");
- $('#success > .alert-success').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×")
- .append("</button>");
- $('#success > .alert-success')
- .append("<?php echo $entry_fo_send_success; ?>");
- $('#success > .alert-success')
- .append('</div>');
- dataLayer.push({
- "event":"ua-event",
- "eventCategory":"zakaz",
- "eventAction":"send"
- });
- // $('#contactForm').trigger("reset");
- } else {
- $('#success').html("<div class='alert alert-danger'>");
- $('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×")
- .append("</button>");
- $('#success > .alert-danger').append("<?php echo $entry_fo_send_error; ?>");
- $('#success > .alert-danger').append('</div>');
- }
- },
- error: function () {
- $('#success').html("<div class='alert alert-danger'>");
- $('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×")
- .append("</button>");
- $('#success > .alert-danger').append("<?php echo $entry_fo_send_error; ?>");
- $('#success > .alert-danger').append('</div>');
- }
- })
- },
- filter: function () {
- return $(this).is(":visible");
- }
- });
- $("a[data-toggle=\"tab\"]").click(function (e) {
- e.preventDefault();
- $(this).tab("show");
- });
- });
- $(function () {
- $.mask.definitions['x'] = '[0-9]';
- $('.telephone_form').mask("<?php echo $config_telephone_mask; ?>", {placeholder: "_"});
- });
- /*When clicking on Full hide fail/success boxes */
- $('#name').focus(function () {
- $('#success').html('');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement