There is the following construction:
<nav> <a href="index/">Главная</a> <a href="docs/">Документы</a> <a href="about/">О Нас</a> <a href="contacts/">Контакты</a> </nav> Clicking on the link is processed as follows:
$('nav a').click(function(){ var hr = 'href=' + $(this).attr('href').slice(0, -1); // читаем href у ссылки $.ajax({ url: 'ajax/', type: 'POST', dataType: 'html', data: hr, success: function(response) { if (response == 'noaction') return true; $('body').prepend(response); return false; }, error: function(response) { return true; } }); return false; // нужно ли оно тут? }) The meaning is as follows: - if AJAX gives an error or an answer (response) == 'noaction', then the browser should "standardly" click on the link to which it was clicked. - if AJAX gives any response other than 'noaction', then insert it into the body and DO NOT follow the link.
My browser never goes, help me figure it out (jQuery is loaded, ajax server gives correct results), I can’t arrange true returns :(