1jQuery(function($) { 2 var form = $('#leadcenter-voucher-form'); 3 4 $('body').on('input', '#npn, #phone_number', function () { 5 this.value = this.value.replace(/\D/g, '').slice(0, 10); // max 10 digits; min enforced on submit 6 }); 7 8 form.submit(function(e) { 9 e.preventDefault(); 10 $('span.error').remove(); 11 $('span.success').remove(); 12 var inputSubmit = $(form).find('input[type="submit"]'); 13 inputSubmit.val('Submitting...'); 14 inputSubmit.attr('disabled', true); 15 $.post(WPJS.ajaxURL, $(this).serializeArray(), function(data) { 16 if(data.success) { 17 form[0].reset(); 18 form.append('<span class="success" style="color: green;">Form submitted successfully.</span>'); 19 } else { 20 if(data.data.errors) { 21 data.data.errors.forEach(error => { 22 var entry = Object.entries(error); 23 form.find('input[name="'+entry[0][0]+'"]').parent().append('<span class="error" style="color: #b50000;">'+entry[0][1]+'</span>'); 24 $('span.error').show(); 25 }); 26 form.append('<span class="error" style="color: #b50000;">Please fill all required fields.</span>'); 27 } else { 28 form.append('<span class="error" style="color: #b50000;">'+data.data.message+'</span>'); 29 } 30 } 31 }).fail(function() { 32 form.append('<span class="error" style="color: #b50000;">An unexpected error occurred. Please try again.</span>'); 33 }).always(function() { 34 inputSubmit.val('Submit'); 35 inputSubmit.removeAttr('disabled'); 36 }) 37 }); 38 39});
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.