$(function() {

    $("#contactForm input,#contactForm textarea").jqBootstrapValidation({
        preventSubmit: true,
        submitError: function($form, event, errors) {
            // additional error messages or events
        },
        submitSuccess: function($form, event) {
            // Prevent spam click and default submit behaviour
            $("#btnSubmit").attr("disabled", true);
            event.preventDefault();
            
            // get values from FORM
            var name = $("input#name").val();
            var email = $("input#email").val();
            var phone = $("input#phone").val();
            var message = $("textarea#message").val();
            var firstName = name; // For Success/Failure Message
            // Check for white space in name for Success/Fail message
            if (firstName.indexOf(' ') >= 0) {
                firstName = name.split(' ').slice(0, -1).join(' ');
            }
            // $.ajax({
            //     url: "././mail/contact_me.php",
            //     type: "POST",
            //     data: {
            //         name: name,
            //         phone: phone,
            //         email: email,
            //         message: message
            //     },
            //     cache: false,
            //     success: function() {
            //         // Enable button & show success message
            //         $("#btnSubmit").attr("disabled", false);
            //         $('#success').html("<div class='alert alert-success'>");
            //         $('#success > .alert-success').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;")
            //             .append("</button>");
            //         $('#success > .alert-success')
            //             .append("<strong>Your message has been sent. </strong>");
            //         $('#success > .alert-success')
            //             .append('</div>');

            //         //clear all fields
            //         $('#contactForm').trigger("reset");
            //     },
            //     error: function() {
            //         // Fail message
            //         $('#success').html("<div class='alert alert-danger'>");
            //         $('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;")
            //             .append("</button>");
            //         $('#success > .alert-danger').append("<strong>Sorry " + firstName + ", it seems that my mail server is not responding. Please try again later!");
            //         $('#success > .alert-danger').append('</div>');
            //         //clear all fields
            //         $('#contactForm').trigger("reset");
            //     },
            // });
        },
        filter: function() {
            return $(this).is(":visible");
        },
    });

    $("a[data-toggle=\"tab\"]").click(function(e) {
        e.preventDefault();
        $(this).tab("show");
    });
});

// When clicking on Full hide fail/success boxes
$('#name').focus(function() {
    $('#success').html('');
});

@@ -941,1886 +941,8 @@
   %7D%0A
-            // $.ajax(%7B%0A            //     url: %22././mail/contact_me.php%22,%0A            //     type: %22POST%22,%0A            //     data: %7B%0A            //         name: name,%0A            //         phone: phone,%0A            //         email: email,%0A            //         message: message%0A            //     %7D,%0A            //     cache: false,%0A            //     success: function() %7B%0A            //         // Enable button & show success message%0A            //         $(%22#btnSubmit%22).attr(%22disabled%22, false);%0A            //         $('#success').html(%22%3Cdiv class='alert alert-success'%3E%22);%0A            //         $('#success %3E .alert-success').html(%22%3Cbutton type='button' class='close' data-dismiss='alert' aria-hidden='true'%3E&times;%22)%0A            //             .append(%22%3C/button%3E%22);%0A            //         $('#success %3E .alert-success')%0A            //             .append(%22%3Cstrong%3EYour message has been sent. %3C/strong%3E%22);%0A            //         $('#success %3E .alert-success')%0A            //             .append('%3C/div%3E');%0A%0A            //         //clear all fields%0A            //         $('#contactForm').trigger(%22reset%22);%0A            //     %7D,%0A            //     error: function() %7B%0A            //         // Fail message%0A            //         $('#success').html(%22%3Cdiv class='alert alert-danger'%3E%22);%0A            //         $('#success %3E .alert-danger').html(%22%3Cbutton type='button' class='close' data-dismiss='alert' aria-hidden='true'%3E&times;%22)%0A            //             .append(%22%3C/button%3E%22);%0A            //         $('#success %3E .alert-danger').append(%22%3Cstrong%3ESorry %22 + firstName + %22, it seems that my mail server is not responding. Please try again later!%22);%0A            //         $('#success %3E .alert-danger').append('%3C/div%3E');%0A            //         //clear all fields%0A            //         $('#contactForm').trigger(%22reset%22);%0A            //     %7D,%0A            // %7D);%0A
     

remove commented ajax contact form