Hello everyone. Next, I made a code for loading content in Ajax and I used history.pushState to change the URL of the browser, but when I click on Back, it does not load the previous address, it just changes the link in the address bar.
How do I when to click the Back button, in addition to changing the URL, loading it?
Thank you for your attention!
JS Code:
function AbreEmDIV(endereco){
var linkMain = endereco.replace("ajax", "main")
var divConteudo = "#conteudo"
var linkAtual = window.location.href
var obj = { Title: '', Url: linkMain };
$.ajax({url: endereco, success: function(result){
$(divConteudo).html(result);
window.history.pushState(obj, obj.Title, obj.Url);
}});
}