How can I link external json file in JSFiddle?

后端 未结 6 1456
北荒
北荒 2021-02-06 07:33
  • I have a very long .json file country.json.

[
  {
    "name": "WORLD",
    "population": 6916183000         


        
6条回答
  •  春和景丽
    2021-02-06 08:10

    You can't load a locally created .json file into Fiddler.

    Here I put a .json file that I found on the web, and you can see the data comes in from it (into the console as well).

    https://jsfiddle.net/v99e25r8/

    $http.get('https://json-generator.appspot.com/api/json/get/bVQoKFSGNu?indent=2')
        .success(function(data) {
            console.log(data);
            $scope.countries = data;
        });
    

    Fiddler aside, if this was within your project you just need to have it point to the correct directory.

提交回复
热议问题