[Answered ]-Injecting js variable in django url

1👍

As DrummerMann suggested it works out like this :

var sensorID = "href='{% url 'agriculture:tree_sensor' 12345 %}'";
var url_mask = sensorID.replace("12345", fields["sensor"]);

and the button to the link

"<br><a class='popup_button small_text' "+url_mask+" ><span>Sensor Page</span></a>"
👤haduki

Leave a comment