'How to set url when opening a modal

I would like to pass a variable into the url when the modal is opened. To achieve that i'm using jquery to set url and then open the modal.

Now my problem is that the modal is getting closed even if i try to open it with jquery .modal('show')

value = 5;
window.location = 'http://localhost:8080/gorr/send.php?o=histlist&sid=value;
$('#sendCertificatesModal').modal('show');



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source