0

I need to pick up the objects from this service.

http://www.geonames.org/childrenJSON?geonameId=3469034&callback=listPlaces&style=long&noCacheIE=1543532747264

but they are coming in one kind of function js

how can I get the value of the geonames attribute ??

enter image description here

2 Answers2

1

The data format you are looking at is JSONP (which is what we used to work around the Same Origin Policy before CORS was designed).

Remove the callback query string parameter from the URL and the service will return plain JSON instead. You can then parse that as normal.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
0

In the url you have &callback=listPlaces. If you take that out you'll get the actual object. It looks like you're expected to have the name of the callback you passed it defined in your code, and by passing callback as a param its returning the actual function call.

Isaac Vidrine
  • 1,568
  • 1
  • 8
  • 20