These lines of code produce an error, my question is, how can I pass the IDS and MESSAGES parameters to windows.location.href in Django view.
$(function () {
console.log("HOME");
let ids = 1;
let messages = "My personal Message";
let myurl = "{% url 'message-page' ids messages %}"; //ERROR HERE: IDS and MESSAGES are variables
return window.location.href = myurl
});
I found a trick that might work under most circumstances:
var url_mask = "{% url 'someview' ids messages %}".replace(/ids/, ids.toString()).replace(/messages/, messages.toString());