1

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?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Freewind
  • 193,756
  • 157
  • 432
  • 708

1 Answers1

3

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.

Pere Villega
  • 16,429
  • 5
  • 63
  • 100
  • Thank you! I'm not very clear about "Jquery Ajax allows you to use PUT or DELETE, but that is not supported by all browsers". I thought it is just jquery send something like "PUT" or "DELETE" to the server side, why it need the support of browsers? – Freewind Mar 09 '12 at 11:02
  • Some browsers can't use Ajax to do a PUT/DELETE request. In the end, jquery is only a wrapper over browser javascript, so that's the limiting factor. JQuery solves most of the issues, but some it can't :) – Pere Villega Mar 09 '12 at 12:54
  • Hope someday I will encounter this problem to see what exactly it is, or never – Freewind Mar 09 '12 at 13:00