Last Updated: February 25, 2016
·
1.228K
· alexanderbrevig

The unintentional AJAX status code 204

DISCLAIMER: This is not considered good practice, but it may save you for many hours, or make the otherwise impossible possible given real world constraints. (This really is not AJAX as it lacks the JAX)

So, let's say you really NEED to implement some way of the user to manipulate some state on the server without the page reloading.

For instance, we want a link that votes up something asynchronously as it is clicked.

We could do that by pointing a regular anchor element to a url that responds with HTTP 204.

That's it!