// Contact Form Scripts $(function() { $("#formLogin input").jqBootstrapValidation({ preventSubmit: true, submitError: function($form, event, errors) { // additional error messages or events }, submitSuccess: function($form, event) { event.preventDefault(); var formData = new FormData($("#formLogin")[0]); $('#button_login').hide(); $("#loading").show(); $.ajax({ url: "http://pinpear.com/_ajax.php", type: "POST", data: formData, contentType: false, processData: false, cache: false, dataType: 'json', success: function(resp){ if (resp.error) { var erroresList = ''; // Fail message $('#msnModal .modal-title').html('Verify the entered data.'); $('#msnModal .modal-detail').html(erroresList); $('#msnModal').modal('show'); $("#loading").hide(); $("#button_login").show(); } else { // OK message $('#formLogin').trigger("reset"); window.location = 'http://pinpear.com/index.php?msn=4'; } }, error: function() { // Fail message $('#msnModal .modal-title').html('We are sorry'); $('#msnModal .modal-detail').html('It seems that my mail server does not respond. Please try again later!'); $('#msnModal').modal('show'); $('#formLogin').trigger("reset"); $("#loading").hide(); $("#button_login").show(); }, }); }, filter: function() { return $(this).is(":visible"); }, }); }); function eventHandler(event, selector) { event.stopPropagation(); event.preventDefault(); if (event.type === 'touchend') selector.off('click'); }