var pin = ""; var datoUsuario = ""; $(document).ready(function () { FastClick.attach(document.body); setEvents(); }); function setEvents() { $(".btnnum").on("click", function () { pin += parseInt($(this).children().html()); $("#txtPin").text(pin); }); $(".btnCancel").on("click", function () { pin = ""; $("#txtPin").text("USUARIO"); }); $(".btnOk").on("click", login); $(".btnconfirmar").on("click", function () { localStorage.setItem("userData", JSON.stringify(datoUsuario)); setTimeout(function () { window.location = "clockIn.html"; }, 200); $(".loading").fadeOut(200); }); } function login() { $.post({ urlPath: 'login', jsonData: [pin], processData: false, success: function (data) { localStorage.setItem("userData", JSON.stringify(data)); $("#txtPin").text("USUARIO O DNI"); pin = ""; window.location = "clockIn.html"; $(".loading").fadeOut(200); } }); }