I am doing a dirty form check. While doing that, if the form value changes I show the user a prompt asking if he/she wants to proceed. If yes, I want to navigate to the url of clicked link. My problem is that I am not able to retain the url.
$("a").click(function (e) {
url = $(this).attr('href');
if(str != $("form").serialize()){
$('#prompt').show();
e.preventDefault();
}
});
I am using the bootstrap dialog to show message that form has been changed. Now if the user still wants to leave page, how do I keep track of the url I need to forward.
<div class="modal-footer">
<a id="hide" class="btn">Stay on Page</a>
<a id="navigate" class="btn" href="#">Leave Page</a>
</div>
$('#navigate').click(function () {
console.log(url)
});
I need a way to retain the value of url, when I close the dialog.