EXTERNAL JSON

Accessing JSON data from a remote server

Let's now see how to avoid the Same Origin Policy issue, i.e. how to retrieve data from a remote server having a different hostname. In this example we retrieve some JSON data from a public free service, to be intented only for testing purposes. The service can be found here.

Remark: since the remote page is exposed to the public only for testing purpose, it's very likely to get a message like "Max quota reached", meaning that we already queried that page for too many times. However, the presence of such messages means that the Ajax call has been succesfull anyway, since we got a response and we recognized it.

To test the remote JSON call, try to select a country

Country
PostalCode/Place
Postal data

For details have a look to HTML code of this page.

Sources

HOME