Hi,

I have a PHP script that returns a JSON object with one property and
one value.

If I use the PHP file on my local web server the following code works:

$.getJSON("myphpfile.php", callback);
function callback(data) {
  alert(data.prop);
}

This produces the alert which contains the correct data

However, if I use the PHP file on a remote server, the above code
generates an error saying 'Permission denied to call method
XMLHttpRequest.open'

I tried changing the code to:

$.getJSON("http://mydomain/myphpfile.php?jsoncallback=?";,
  function(data) {
    alert(data.prop);
  });

But this does not work and the alert never appears. I don't get any
JavaScript errors, and Firebug even shows the correct JSON object in
the response, it just doesn't execute the function, why is this?

Does the PHP file need to do something other than echo the JSON?

Reply via email to