1👍
✅
This issue is related to javascript.
The str function does not exist in javascript. So if it is in a template use :
location.href = "/maintenance/tasks/2/toggleCompletion/" + task_id + "/";
Bonus :
Please, do not use alert to debug your code, prefer console.log method.
Source:stackexchange.com