In my JavaScript function, I am passing parameters and using alert to confirm that the function is receiving the parameters correctly. However, when trying to pass these parameters in a Django URL, it is not working unless I pass a string instead.
function myFunction(a) {
var v = a.value;
alert(v);
location.href="{% url 'new_event' v %}"; // This line does not work
location.href="{% url 'new_event' 'string' %}"; // This line works
}
I have verified that the value being received is a string as expected, but I am unsure of how to successfully pass it in the URL.