How to disable open link with the event .on('click')?

My site is an ajax handler references. $('body').on('click','.ajax_post', function () {}, but when clicking on a link, if there is a url in the href opens the link and not the content in the container. Like when you click on this link to ban open link in a new page?
The website is designed for radio, and I can't give to pogruzitsya, again all scripts.
At the same time, I can't do without the href parameter, because we want dcti an opportunity for the search engines to see what GTA link leads to this page.
April 19th 20 at 12:12
2 answers
April 19th 20 at 12:14
.the stoppropagation()
April 19th 20 at 12:16
The answer lay here, many of the events give rise to the execution of their associated actions. For example, immediately after the link click event occurs, a transition to another page. To undo these steps, inside an event handler call event.preventDefault(). Of course, not all events generate more actions and not all actions can be prevented
$('body').on('click','.ajax_post', function (event) {
// then Your handler.


// search for all links and hang events for all links in our document
$(document).on('click', 'a.ajax', function() {
// put the link to the story
history.pushState(null, null, this.href);

// it can trigger the loading of data, etc.

// don't allow to execute the default action
return false;

Find more questions by tags jQuery