1 2$(".form-btn").click(function(){ 3 'use strict'; 4 5 var $form = $('#contact-form'); 6 7 $form.submit(function (e) { 8 // remove the error class 9 $('.form-group').removeClass('has-error'); 10 $('.help-block').remove(); 11 12 // get the form data 13 var formData = { 14 'fname' : $('input[name="form-fname"]').val(), 15 'lname' : $('input[name="form-lname"]').val(), 16 'email' : $('input[name="form-email"]').val(), 17 'subject' : $('input[name="form-subject"]').val(), 18 'message' : $('textarea[name="form-message"]').val() 19 }; 20 // process the form 21 $.ajax({ 22 type : 'POST', 23 url : 'php/process.php', 24 data : formData, 25 dataType : 'json', 26 encode : true 27 }).done(function (data) { 28 // handle errors 29 if (!data.success) { 30 if (data.errors.fname) { 31 $('#fname-field').addClass('has-error'); 32 $('#fname-field').find('.form-group').append('<span class="help-block">' + data.errors.fname + '</span>'); 33 } 34 if (data.errors.lname) { 35 $('#lname-field').addClass('has-error'); 36 $('#lname-field').find('.form-group').append('<span class="help-block">' + data.errors.lname + '</span>'); 37 } 38 39 40 if (data.errors.email) { 41 $('#email-field').addClass('has-error'); 42 $('#email-field').find('.form-group').append('<span class="help-block">' + data.errors.email + '</span>'); 43 } 44 45 if (data.errors.subject) { 46 $('#subject-field').addClass('has-error'); 47 $('#subject-field').find('.form-group').append('<span class="help-block">' + data.errors.subject + '</span>'); 48 } 49 50 if (data.errors.message) { 51 $('#message-field').addClass('has-error'); 52 $('#message-field').find('.form-group').append('<span class="help-block">' + data.errors.message + '</span>'); 53 } 54 } else { 55 // display success message 56 $form.html('<div class="alert alert-success">' + data.message + '</div>'); 57 } 58 }).fail(function (data) { 59 // for debug 60 console.log(data) 61 }); 62 63 e.preventDefault(); 64 }); 65});
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.