Answer the question
In order to leave comments, you need to log in
What url format to set in the script?
I am doing a tour of the site, by analogy with intro, js, and it is necessary to implement a transition to another page, using this js code:
document.getElementById('start').onclick = function() {
introJs().setOption('doneLabel', 'Next page').start().oncomplete(function() {
window.location.href = 'second.html?multipage=true';
});
};
Answer the question
In order to leave comments, you need to log in
Of course it doesn't work, the template engine that processes the construction {% url 'clients:product-create' %}
works on the server, and the javascript works in the user's browser and has no idea how to process this. To solve this problem, there are many options. One of them is to include in the template from which the request will occur, the code of the form
<script type="text/javascript">
window.urls = {
clientProductCreate: {% url 'clients:product-create' %}
}
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question