You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -95,7 +95,7 @@ When nothing is returned as result of view then returns (JSON format):
95
95
c =2+3
96
96
return {'result': c}
97
97
98
-
The result is send to the browser in the following way (JSON format)
98
+
The whole result is converted into a JSON format as part of the `content' element:
99
99
100
100
.. code:: javascript
101
101
@@ -115,7 +115,8 @@ The result is send to the browser in the following way (JSON format)
115
115
# if the request.user is anonymous then this view not proceed
116
116
return {'user_id': request.user.id}
117
117
118
-
The JSON response:
118
+
The location or path of the redirection response will be given in the `content` item,
119
+
also the `status` and `statusText` will reflect what is going on:
119
120
120
121
.. code:: javascript
121
122
@@ -159,19 +160,17 @@ The JSON response:
159
160
AJAXMiddleware
160
161
~~~~~~~~~~~~~~
161
162
162
-
If you use AJAX quite frequently in your project, we suggest using the AJAXMiddleware described below.
163
-
164
-
Add ``django_ajax.middleware.AJAXMiddleware`` into the ``MIDDLEWARE_CLASSES`` list in ``settings.py``.
163
+
If you are using AJAX at all times in your project, we suggest you activate the AJAXMiddleware described below.
165
164
166
-
All your responses will be converted to JSON if the request was made by AJAX, otherwise is return a HttpResponse.
165
+
Add ``django_ajax.middleware.AJAXMiddleware`` to the ``MIDDLEWARE_CLASSES`` list in ``settings.py`` and all your responses will be converted to JSON whereas the request was made via AJAX, otherwise it will return a normal HttpResponse.
167
166
168
-
.. caution:: If you use this middleware cannot use ``@ajax`` decorator.
167
+
.. caution:: If this middleware is activated you cannot use the ``@ajax`` decorator. That will cause double JSON conversion.
169
168
170
169
171
170
AJAXMixin for class-based views
172
171
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
173
172
174
-
``AJAXMixin`` is an object that calls the AJAX decorator.
173
+
``AJAXMixin`` is an object that call to AJAX decorator.
0 commit comments