M
M
Maxim Vasiliev2013-11-15 06:11:52
Google Chrome
Maxim Vasiliev, 2013-11-15 06:11:52

Chrome doesn't display server json response in console

I fill in the url (intended for Ajax) in the address bar, the server's response is displayed on the page. But this is json, and I would like to see it in a parsed form, as is usually the case in the "preview" tab. But there instead "no preview available", "no response data available".

What am I doing wrong?

(well, except that you need to use some plugin to debug Ajax requests)

The server response is something like this:

HTTP/1.0 200 OK
Access-Control-Allow-Headers: accept,origin,x-requested-with,range,x-fields
Access-Control-Expose-Headers: content-range,x-fields
X-Fields: guid,admpath,name
Vary: X-Fields
Content-Range: items 0-91/92
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: OPTIONS,GET
Content-Type: application/json
Content-Length: 26733
Server: Werkzeug/0.9.4 Python/2.7.3
Date: Fri, 15 Nov 2013 01:30:14 GMT

Answer the question

In order to leave comments, you need to log in

5 answer(s)
N
Nikita Kolosov, 2013-11-15
@Anexroid

you also need to set header Accept:application/json

M
Maxim Vasiliev, 2013-11-15
@qmax

Accept: tried to set, does not help.

GET /addr/ HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Cache-Control: no-cache
Accept: application/json
Pragma: no-cache
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.114 Safari/537.36
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Cookie: csrftoken=3V2ntHJJHr0v8zXBvcHyX0aYxG4bPzIS

D
Dmitry, 2013-11-15
@Dimitriys

for example, I filter ajax requests by $_SERVER['HTTP_X_REQUESTED_WITH']=XMLHttpRequest, try adding X-Requested-With: XMLHttpRequest to the headers

M
mayorovp, 2013-11-15
@mayorovp

It is better to make this request directly from the console - then the answer will be printed in it according to all the rules.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question