score:2

Accepted answer

You can either include the json file in the html by

<script src="thejsonFile.js"></script>

And the json file

var jsonObject = [{"countryName":"Afghanistan","year":"1960","cases":"887"},{"countryName":"Afghanistan","year":"1965","cases":"218"}];

And use jsonObject in your functions.

Or you can call it by ajax

$.get('thejsonFile.js', function(data){
  var jsonObject = JSON.parse(data);
  //then your functions
});

Where the thejsonFile.js should be like

[{"countryName":"Afghanistan","year":"1960","cases":"887"},{"countryName":"Afghanistan","year":"1965","cases":"218"}];
//without declaration.

Related Query