1/*==============================================================*/ 2// Sinmun Contact Form JS 3/*==============================================================*/ 4(function ($) { 5 "use strict"; // Start of use strict 6 $("#contactForm").validator().on("submit", function (event) { 7 if (event.isDefaultPrevented()) { 8 // handle the invalid form... 9 formError(); 10 submitMSG(false, "Did you fill in the form properly?"); 11 } else { 12 // everything looks good! 13 event.preventDefault(); 14 submitForm(); 15 } 16 }); 17 18 19 function submitForm(){ 20 // Initiate Variables With Form Content 21 var name = $("#name").val(); 22 var email = $("#email").val(); 23 var msg_subject = $("#msg_subject").val(); 24 var phone_number = $("#phone_number").val(); 25 var message = $("#message").val(); 26 27 28 $.ajax({ 29 type: "POST", 30 url: "assets/php/form-process.php", 31 data: "name=" + name + "&email=" + email + "&msg_subject=" + msg_subject + "&message=" + message, 32 success : function(text){ 33 if (text == "success"){ 34 formSuccess(); 35 } else { 36 formError(); 37 submitMSG(false,text); 38 } 39 } 40 }); 41 } 42 43 function formSuccess(){ 44 $("#contactForm")[0].reset(); 45 submitMSG(true, "Message Submitted!") 46 } 47 48 function formError(){ 49 $("#contactForm").removeClass().addClass('shake animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){ 50 $(this).removeClass(); 51 }); 52 } 53 54 function submitMSG(valid, msg){ 55 if(valid){ 56 var msgClasses = "h4 text-left tada animated text-success"; 57 } else { 58 var msgClasses = "h4 text-left text-danger"; 59 } 60 $("#msgSubmit").removeClass().addClass(msgClasses).text(msg); 61 } 62}(jQuery)); // End of use strict
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.