Hacking away on a project recently I decided to use the lesser-known HTTP status code 204 No Content. A 204 No Content indicates a successful request, but also that there’s no content to return. I’m using 204’s for responding to AJAX calls to server-side resources for which no content is needed to return. Technically I could use a 200 status code but I want to be as semantically correct as possible.
Using Grails for the project it was super simple to return 204 from my controller. Here’s how you do it:
1 2 3 4 5 6 7 8 9 10 11 | |
That’s it.