diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index 8e42fa1fa4..61140d0e6f 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -314,6 +314,13 @@ Methods If you write your own XMLHttpRequest call (on the browser side), you'll have to set this header manually if you want ``is_ajax()`` to work. + If a response varies on whether or not it's requested via AJAX and you are + using some form of caching like Django's :mod:`cache middleware + `, you should decorate the view with + :func:`vary_on_headers('HTTP_X_REQUESTED_WITH') + ` so that the responses are + properly cached. + .. method:: HttpRequest.read(size=None) .. method:: HttpRequest.readline() .. method:: HttpRequest.readlines()