1/* 2 -------------------------------- 3 Ajax Contact Form 4 -------------------------------- 5 + https://github.com/pinceladasdaweb/Ajax-Contact-Form 6 + A Simple Ajax Contact Form developed in PHP with HTML5 Form validation. 7 + Has a fallback in jQuery for browsers that do not support HTML5 form validation. 8 + version 1.0.1 9 + Copyright 2014 Pedro Rogerio 10 + Licensed under the MIT license 11 + https://github.com/pinceladasdaweb/Ajax-Contact-Form 12 */ 13 14function sendAjaxForm(form) 15{ 16 $(form).find(".cf-loader").show(); 17 var formData = $(form).serialize(); 18 // process the form 19 $.ajax({ 20 type: 'POST', 21 url: $(form).attr("action"), 22 data: formData, 23 dataType: 'json', 24 encode: true 25 }).done(function (data) { 26 if (!data.success) { 27 // Error 28 $(form).find(".error-box").show(); 29 } else { 30 // Success 31 $(form).html($(form).find(".success-box").html()); 32 } 33 $(form).find(".cf-loader").hide(); 34 }).fail(function (data) { 35 // Error 36 $(form).find(".error-box").show(); 37 $(form).find(".cf-loader").hide(); 38 }); 39} 40 41(function ($, window, document, undefined) { 42 'use strict'; 43 44 $(document).ready(function () { 45 $('.form-ajax').each(function (index) { 46 var form = this; 47 48 $(form).submit(function (e) { 49 e.preventDefault(); 50 // remove the error class 51 $('.form-group').removeClass('has-error'); 52 $('.help-block').remove(); 53 if (typeof grecaptcha !== 'undefined') { 54 var $captchaResponse = $(form).find('textarea[name="g-recaptcha-response"]'); 55 var token = $captchaResponse.val(); 56 57 if (!$captchaResponse.length || !token) { 58 // nenà odÅ¡krtnuto / nenà vyÅeÅ¡ená CAPTCHA 59 $(form).find(".error-box") 60 .text('ProsÃm, potvrÄte, že nejste robot.') 61 .show(); 62 return false; 63 } 64 } 65 66 sendAjaxForm(form); 67 68 69 }); 70 }); 71 }); 72 73}(jQuery, window, document));
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.