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
Copy file name to clipboardExpand all lines: user_guide_src/source/general/ajax.rst
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,8 @@ Here's how to force the ``X-Requested-With`` header to be sent in the Fetch API
11
11
Fetch API
12
12
=========
13
13
14
+
.. code-block:: javascript
15
+
14
16
fetch(url, {
15
17
method:"get",
16
18
headers: {
@@ -29,23 +31,29 @@ jQuery
29
31
30
32
For libraries like jQuery for example, it is not necessary to make explicit the sending of this header, because according to the official documentation <https://api.jquery.com/jquery.ajax/> it is a standard header for all requests ``$.ajax()``. But if you still want to force the shipment to not take risks, just do it as follows:
31
33
34
+
.. code-block:: javascript
35
+
32
36
$.ajax({
33
37
url:"your url",
34
38
35
39
headers: {'X-Requested-With':'XMLHttpRequest'}
36
40
37
-
});
41
+
});
38
42
39
43
40
44
VueJS
41
45
=====
42
46
43
47
In VueJS you just need to add the following code to the ``created`` function, as long as you are using Axios for this type of request.
0 commit comments