$.getJSON('1.json', function(data) { console.log(data); } ); 

Should such a script work if the html file in which it is written is in the same folder as 1.json?

Closed due to the fact that off-topic participants Alexey Shimansky , user194374, Grundy , zRrr , D-side 14 Mar '16 at 12:42 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - Alexey Shimansky, Community Spirit, Grundy, zRrr, D-side
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    Yes. And if something is not working for you, then look at the console. - Deonis
  • one
    The answer to the request is watching - Deonis
  • one
    @Yuri, and json checked? Is he valid? - skubarenko
  • one
    By the way, yes ... Regarding the validity and why I don’t like shorthand methods so much: As the json file contains a syntax error, it will usually fail silently. - Deonis
  • one
    @ nuts119 Thank you all) It was empty, now everything works) - Yuri

1 answer 1

First, open DevTools ( Chrome, YandexBrowser, Opera> 12.18, Amigo, Vivaldi and etc on the Chromium engine ) with the F12 key

  1. Network tab - All communication with the network here (XHR === AJAX, and other files Web sockets, etc.)
  2. Request to the server for comment
  3. The address where we knock the full appears when you hover (but you can turn on the panel above the display of the full path immediately next to the icon [View:] I think you will find :-))
  4. XHR - filter requests to the server AJAX (getJSON and atc)
  5. Preview is a tab in which the response from the server is displayed.
  6. And this is the answer from the server.

Screenshot