Anonymous Anonymous - 9 days ago
134 0

i can't add Jquery library to my codes and i have to use js code


can somebody help me with converting following code to js

jQuery

jq to js

$('document').ready(function(){
    $('.historyAPI').on('click', function(e){      

        e.preventDefault();

        var href = $(this).attr('href');

        getContent(href, true);
    });
});

window.addEventListener("popstate", function(e) {

    getContent(location.pathname, false);
});

function getContent(url, addEntry) {
    $.get(url).done(function(data) {

        $('#content').html($(data).find("#content").html());
        $('#content2').html($(data).find("#content2").html());
      
        if(addEntry == true) {
            
            history.pushState(null, null, url); 
        }
    });
}