views:

208

answers:

3

Hello,

I am working with json data together with jQuery. It works perfectly fine when using a local json file, but shows just a blank page when using a remote json file from another server (even when using a complete URL from my own server).

This works:

$.getJSON('9.json', function(data) {

Does does not work:

$.getJSON('http://beta.ambadoo.com/users/9.json', function(data) {

Does anyone know how to fix it?

Thanks!

A: 

As of jQuery 1.2, you can load JSON data located on another domain if you specify a JSONP callback.

Source: http://docs.jquery.com/Ajax/jQuery.getJSON

The Solution :)

Sarfraz
+1  A: 

same server, same port. use jsonp.

Sky Sanders
A: 

See this article.

Seems that the magic is doing the '&callback=?'.

Beginning with version 1.2, jQuery has had native support for JSONP calls. You can load JSON data located on another domain if you specify a JSONP callback, which can be done using the following syntax: url?callback=?.

Aito
Jonathan Clark
Try this URL: 'beta.ambadoo.com/users/9.json?callback=?', The ampersand is if you pass other parameters...
Aito
Tried that too and unfortunately still a blank page. Could it be that the API does not support JSONP? How can I check?
Jonathan Clark