How to create a “DELETE” link in play2?
-
13-11-2019 - |
Question
Play2 supports restful url, we can define in "routes" file:
DELETE /users/:id controllers.Users.delete(id)
But how do I create such a link in template? Is there a helper method to use, or do I have to add a special parameter in the url?
Solution
DELETE is not supported by HTML yet. There is a proposal so it's supported in HTML 5, but it's not implemented anywhere.
So, no, you can't trigger that from a template directly. Jquery Ajax allows you to use PUT or DELETE, but that is not supported by all browsers.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow