1function returnError(timeAlert) { 2 3 $('#loading').hide(); 4 $('#alert-error').show(); 5 $('.bx-alert').delay(timeAlert).fadeOut(); 6} 7 8function returnSuccess(form, timeAlert) { 9 10 $('#alert-ok').show(); 11 12 $(form).each(function () { 13 14 $('#loading').hide(); 15 $('.bx-alert').delay(timeAlert).fadeOut(); 16 this.reset(); 17 }); 18} 19 20function montaAjax(botao, form, arquivoAjax, tempoAlerta, tempoAlertaErro) { 21 22 $(botao).click(function (e) { 23 24 e.preventDefault(); 25 26 $('#loading').show(); 27 28 function enviaForm() { 29 30 var values = $(form).serialize(); 31 32 $.ajax({ 33 url: arquivoAjax, 34 dataType: 'json', 35 type: "post", 36 data: values, 37 cache: false, 38 success: function (response) { 39 40 if (response.error) 41 returnError(tempoAlerta); 42 43 if (response.success) 44 returnSuccess(form, tempoAlerta) 45 }, 46 error: function (response) { 47 48 if (response.error) 49 returnError(tempoAlertaErro); 50 51 if (response.success) 52 returnSuccess(form, tempoAlertaErro) 53 } 54 }); 55 } 56 57 //token do recaptcha e gerado aqui, no clique, nao mais no load da 58 //pagina (era o maior item isolado de TBT do PageSpeed). Se falhar 59 //(bloqueador de anuncios, script nao carregado), segue o envio 60 //mesmo assim: o backend retorna o mesmo "error" de sempre. 61 getRecaptchaToken().then(enviaForm, enviaForm); 62 }); 63} 64 65$(document).ready(function () { 66 67 montaAjax('#enviar2', '#form-contato', 'contatoAjax.php', '4000', '8000'); //contato 68 montaAjax('#enviar3', '#form-trabalhe', 'trabalheAjax.php', '4000', '8000'); //trabalhe-conosco 69});
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.