CINXE.COM
<form action="/es/widgets/home.html" class="form modal-form" method="post" id="formLogin"> <h2>Conectarse</h2> <label for="emailLogin">EMAIL</label> <input id="emailLogin" name="emailLogin" placeholder="Inserta tu email" type="text"> <label for="password">CONTRASE脩A</label> <input id="password" name="password" placeholder="Inserta tu contrase帽a" type="password"> <div class="login-actions"> <a class="modalwindow fancybox.ajax" href="/es/users/password.html">驴Has olvidado tu contrase帽a?</a> </div> <div class="buttons"> <a href="javascript:enviaFormLogin()" class="button button-primary" >Entrar</a> </div> </form> <script type="text/javascript"> $(document).ready(function () { $('#formLogin input').tooltipster({ trigger: 'custom', // default is 'hover' which is no good here onlyOne: false, // allow multiple tips to be open at a time position: 'right' // display the tips to the right of the element }); $('#formLogin select').tooltipster({ trigger: 'custom', // default is 'hover' which is no good here onlyOne: false, // allow multiple tips to be open at a time position: 'right' // display the tips to the right of the element }); $("#formLogin").validate({ errorPlacement: function (error, element) { //console.info("errorPlacement: "+element.attr('name')); $(element).tooltipster('update', $(error).text()); $(element).tooltipster('show'); $(element).addClass('has-error'); }, success: function (label, element) { //console.info("success:"+element.name); $(element).tooltipster('hide'); $(element).removeClass('has-error'); $(element).removeClass('required-field'); }, rules: { emailLogin: "required", password: "required", }, messages: { emailLogin: "Debes introducir el email", password: "Debes introducir la contrase帽a", }, submitHandler: function (form) { $(".fancybox-overlay.fancybox-overlay-fixed.video").css("display", "none"); mostrarCargador(); $.ajax({ type: 'POST', url: "/es/users/login.html", data: {emailLogin: $("#emailLogin").val(), password: $("#password").val()} // contentType: "application/json; charset=utf-8", // dataType: 'json' }).done(function (res) { // tratarConfirmacion(res); ocultarCargador(); if ("ok" == res) { // ga("send", "event", "Affiliate", "Login", "", 1); window.location.href = "/es/widgets/home.html"; } else { $.fancybox.close(); alert("Email o contrase帽a no v谩lidos"); } }).error(function (jqXHR, textStatus, errorThrown) { ocultarCargador(); alert("隆Ups, ha habido un problema!") }); }, }); }); function enviaFormLogin() { $("#formLogin").submit(); } $(document).keypress(function(event) { if (event.which === 13) { // tecla enter enviaFormLogin(); } }); </script>