I would like to eliminate the redirection in the a
tag since currently when I click, a modal opens, but I do not want to be redirected to the browser page, I have tried with preventdefault
and it does not work for me. I'm working with C # MVC. Could it be that I'm overloaded somewhere else? Or are there other solutions to prevent me from redirecting? As a last option I would not like to change it to span
or div
or button
.
algo.cshtml
<a id="modalAboutButton">Ir a about </a>
<div id="aboutModal" class="reveal-modal" data-reveal></div>
app.js
$(document).ready(function () {
$(document).on('click', '#modalAboutButton', function (e) {
e.preventDefault();
var $modal = $('#aboutModal');
$.get('/About/Index2', function (resp) {
$modal.html(resp).foundation('reveal', 'open');
});
});
});