var Idioma="es"; $(document).ready(function(){ console.log("# READY CONTACTO IDIOMA:" + Idioma); $("#CheckLegal").prop('checked', false); $('#BotConsulta').click(function(){ $('#FrmConsulta').submit(); return false; }); $('#WinCerrar').click(function(){ $("#Popup").hide(); return false; }); $('#ClosePopupExito').click(function(){ $("#PopupExito").hide(); return false; }); }); $('#FrmConsulta').submit(function(e){ e.preventDefault(); if(!$("#CheckLegal")[0].checked) { if (Idioma=="en") { $("#TextoPopup").html("Please, read and accept privacy conditions"); } else { $("#TextoPopup").html("Por favor, lea y acepte el Aviso Legal y Condiciones de Privacidad."); } $("#Popup").show(); return; } $.ajax({ type: "POST", url: "https://dataprius.com/amb.consulta/", data: $(this).serialize(), datatype : 'html', success: function(data) { if(strStartsWith(data,"error:")) { var arrResult= data.split(":"); var msg=arrResult[1]; console.log("# ERROR " + data); $("#TextoPopup").html(msg); $("#Popup").show(); } else { $("#ValNombre").val(""); $("#ValEmail").val(""); $("#ValConsulta").val(""); if ($("#HiddeLanguage").length) { $("#TextoExito").html("Your question has been sent.
We will respond shortly."); } else { $("#TextoExito").html("Su consulta ha sido enviada.
Le responderemos en breve."); } $("#PopupExito").show(); } } }); return false; }); function strStartsWith(str, prefix) { return str.indexOf(prefix) === 0; }