Axios cross-domain request. The front-end response cannot receive data.

in a cross-domain request, a get request from axios sent two requests for options and get

use .then (response = > console.log (response.data)) to output the result returned in the background, but you can see the return of the get request

in the browser console.

clipboard.png

how does axios get the data returned by the following get request

May.22,2021

1. If there is a custom header, in the request, a pre-request with the method of options will be sent before sending the real request, which is used to test whether the server can accept the real request.
2. Cross-domain requests don't get response in the first place.


is the correct way to write


Why not try printing the value of response, maybe.


will be posted back. Cross-domain requests can also request data if they are not set to allow cross-domain, but you cannot get the request data in the code.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be5d35-31795.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be5d35-31795.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?