(function(){
$('a').on('click', function(e){
e.preventDefault();
var url = $(this).attr('href');
$.get(url, function(html){
$('.main').empty().append(html);
});
});
})();
I have this function to avoid the reload with postback, I only load a few elements inside the div "main". Surely because of not being the best way to fulfill this task, the request is duplicated every time I click on a link. increases progressively in addition, the first click doubles twice, the second 3, the third 9 etc ...
Any solution or other function that helps me do this? Thank you very much in advance.
They have already solved my problem, but if they think there is a better function, I would appreciate the help.