There are a number of HTTP status codes, mainly 1xx (temporary response), 2xx (Success), 3xx (redirected), 4xx (Request error), and 5xx (server error) Five large categories, each large class also corresponds to some specific classification. Usually we contact more is 200, 400, 500 and so on.
Here we mainly discuss the status Code 204, in HTTP RFC 2616, the description of 204 is as follows:
If the client is a user agent, it should isn't the change of its document view from this which caused the request to be sent. This response was primarily intended to allow input for actions to take place without causing a change to the user agent ' s Active Document view, although any new or updated metainformation should is applied to the document currently in the user Agent ' s active view.
The meaning is equal to the successful execution of the request, but without the data, the browser does not have to refresh the page . How to understand this passage. Let's say it by example, assuming there's a form on the page, Submit the URL is http-204.htm, submit form, under normal circumstances, the page will jump to http-204.htm, but if the corresponding status code of http-204.htm is 204, then the page will not happen to jump, or stay on the current page. Also for a tag, if the link page response code is 204, the page will not jump.
Therefore, for some data submitted to the server processing, only need to return the success of the case, you can consider using the status code 204来 as the return information, thereby eliminating the unnecessary data transfer.
About HTTP status Code 204 understanding