Ticket #6616: is_ajax.diff
File is_ajax.diff, 1.3 KB (added by , 17 years ago) |
---|
-
django/http/__init__.py
79 79 80 80 def is_secure(self): 81 81 return os.environ.get("HTTPS") == "on" 82 83 def is_ajax(self): 84 return 'HTTP_X_REQUESTED_WITH' in self.META \ 85 and self.META['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' 82 86 83 87 def _set_encoding(self, val): 84 88 """ -
docs/request_response.txt
189 189 Returns ``True`` if the request is secure; that is, if it was made with 190 190 HTTPS. 191 191 192 ``is_ajax()`` 193 **New in Django development version** 194 195 Returns ``True`` if the request was made via an XMLHttpRequest by checking 196 for the 'HTTP_X_REQUESTED_WITH' header for the string 'XMLHttpRequest'. The 197 following major Javascript libraries send this header: 198 199 * Prototype 200 * jQuery 201 * Dojo 202 * MochiKit 203 * MooTools 204 * YUI 205 206 If you write your own XMLHttpRequest, you will have to set this header 207 manually to use this method. 208 192 209 QueryDict objects 193 210 ----------------- 194 211