$(document).ready(function () { root = $('#root').data('root'), type = 'POST', url = decodeURI(window.location.href); $('#login button').click(function () { var i = $('.i').val(), p = $('.p').val(), c = $('.c').val(); if (i.length > 3 && p.length > 5 && c.length > 1) { open_wait(); $.ajax({ type: type, url: root + 'home/vhod', data: { l: 1, i: i, p: p, c: c } }).done(function (data) { if (data == '1') { alert('Успешен вход!'); } else { alert('Провал при вход !!!'); } refresh(); }).fail(function () { alert('Сървърът не отговаря !!!'); close_wait(); }); } }); });