I am trying to fetch this json object from this url:
https://test3.diavgeia.gov.gr/luminapi/opendata/dictionaries//KANONISTIKI_PRAXI_TYPE.json
You might not get much since it's in greek but you get the jsonformat.
Here's my code:
function getDicts() {
api_url = 'https://test3.diavgeia.gov.gr/luminapi/opendata/dictionaries/KANONISTIKI_PRAXI_TYPE.json'
$.ajax({
headers: {
'Access-Control-Allow-Origin': '*',
},
url: api_url,
type: "GET",
crossDomain: true,
dataType: 'jsonp',
success: function(api_data) {
var obj = $.parseJSON(api_data);
console.log(obj);
},
error: function(error) {
console.log(error);
},
});
};
};
getDicts();
If I use jsonas the
dataType` I get the error:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the json data
This is a screenshot from my call:
Here's a fiddle : https://jsfiddle.net/danee/sz7tLru8/
UPDATE!
I changed slightly the function, following some examples I found. Using the jsonp dataType
, on the Network tab I do get a json object but on the console I get this:
SyntaxError: missing ; before statement[Learn More] KANONISTIKI_PRAXI_TYPE.json:1:7
Here's a screenshot from the call with jsonp
.
That seems like an error on the json object? Haven't encountered that before.
I have updated the fiddle as well, but I get nothing there, no response.