1 2jQuery(document).ready(function($) { 3 // 'use strict'; 4 5 ajaxCF($); 6}); 7 8var ajaxCF = function($) { 9 if (!$('form.beatswave_contactform').length) { 10 return; 11 } 12 $("form.beatswave_contactform").submit(function(event) { 13 $('.beatswave_cf_error').removeAttr('style'); 14 event.preventDefault(); 15 16 var name = $.trim($(this).find("input#contactName").val()); 17 var email = $.trim($(this).find("input#contactemail").val()); 18 var website = $.trim($(this).find("input#contactWebsite").val()); 19 var message = $.trim($(this).find("textarea#commentsText").val()); 20 var required_is_empty = false; 21 22 if ('' == name) { 23 required_is_empty = true; 24 $(this).find('.comment-form-author').find('.beatswave_cf_error').show('slow'); 25 } 26 27 if ('' == email) { 28 required_is_empty = true; 29 $(this).find('.comment-form-email').find('.beatswave_cf_error').show('slow'); 30 } 31 32 if ('' == message) { 33 required_is_empty = true; 34 $(this).find('.comment-form-comment').find('.beatswave_cf_error').show('slow'); 35 } 36 37 if (required_is_empty) { 38 return; 39 } 40 41 var data = { 42 action: 'beatswavecontactform_action', 43 data: $(this).find(":input").serialize() 44 }; 45 46 $.post(DATAVALUES.ajaxurl, data, function(response) { 47 var obj; 48 49 try { 50 obj = $.parseJSON(response); 51 } 52 catch(e) { 53 alert("Unexpected problem occurred when sending the email."); 54 return; 55 } 56 57 if(obj.success === true) { 58 $("form.beatswave_contactform").find(".formResultOK").find(".beatswave_cf_error").show("slow"); 59 60 $("form.beatswave_contactform").find("input#contactName").val(''); 61 $("form.beatswave_contactform").find("input#contactemail").val(''); 62 $("form.beatswave_contactform").find("input#phone").val(''); 63 $("form.beatswave_contactform").find("textarea#commentsText").val(''); 64 } else { 65 if (obj.error === 'wp_mail_failed') { 66 $("form.beatswave_contactform").find(".wp_mail_error").find(".beatswave_cf_error").show("slow"); 67 } 68 } 69 }); 70 71 }); 72}
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.