I have a button, which redirect to different pages depands on some logic. I want to be able to get the new loaded page's url after I click on the above button.

the button I use has id="place-order-btn"

JS code

document.getElementById("place-order-btn").onclick = function(){
    verifyPayement()
};

function verifyPayement(){
    var currentUrl = window.location.href;
    alert(currentUrl);
}

Of course the previous function get me the current page url and not the url of the page I get redirected to after clicking the button.. Any ideas?

0 Answers