javascript - res can be printed under Chrome, but the values ​​returned by Response and Preview cannot be seen under F12
巴扎黑
巴扎黑 2017-05-16 13:42:08
0
6
719

1. Request written with vue-resource.
2. The code is as follows:


The following is the 200 data returned by this request. I printed it out, as shown below:


Then the problem is, when I click on Preview and Response, I can’t see the return value, as shown below:


What is the reason. . . [Note: This is a cross-domain request]

!!!Supplement: [This is a post request]

Moreover, I tested it in Firefox and found that I can get the values ​​returned by Response and Preview. The initial conclusion is that it's Google's problem.

巴扎黑
巴扎黑

reply all(6)
为情所困

Chrome 56 and above will have this problem when making cross-domain requests locally. The solution is:

  1. Back to version 55

  2. You should now perform cross-domain requests by setting Access-Control-Allow-Origin. If possible, set proxyTable to perform cross-domain requests during local debugging

This problem has been bothering me for a long time, and I also want to know if there is a more reasonable method

PHPzhong

Please change the browser and take a look. I've encountered it before, sometimes it's there and sometimes it's not, but it doesn't matter.

伊谢尔伦

This problem occurs only when Request Mehod is options

滿天的星座

I have encountered this problem before, because the content-type returned by this address is not json format, but octet-stream, binary data, so what is displayed is a blob object, which seems to be mainly used to download files. I will update vue later. -After the version of resource, it will be automatically converted to json, or you can use the reader to read it again and then convert it to json

洪涛

The method of your request is options. It is to determine whether cross-domain requests are allowed, not the actual request. There should be another request with the same URL and the method is post, which is the actual request.

滿天的星座

Added a little bit later.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!