I have the following code in a template ("home.html") in my Django project
function deleteData(toBeDeleted) {
$.ajax({
type: "GET",
url: "{% url 'delete_data' **[Replace me]** 'all' %}",
success: function (data) {
alert(data)
}
})
}
I need to reach the url 'delete_data' with 2 arguments where the 2nd argument is 'all' and the 1st argument is a javascript variable called "toBeDeleted" (Passed in as a function argument)
A work around i have thought about is...
url: `/delete_data/$(toBeDeleted)/all`,
But in that case i will have to change that as well when changing the url for deleting data other than just changing the urls.py file
Is there a way to make this work or do i have to give up on using {% url ... %}?