Jquery getJSON cross domain problems

altCognito is correct. Here is a working example:

Put this in the top of your page you are calling from, in the

$.getJSON("http://www.yourotherdomain.com/testcross.php?jsoncallback=?",
  function(data) {
    $('body').html(data.name).css("color", "green");
  }
);

and the php that would return stuff:

$data="{"name" : "hello world"}";
echo $_GET['jsoncallback'] . '(' . $data . ');';

Leave a Comment