1

I'm using jquery to process the json on another domain. I'm using json2.js and testing this in IE9 and IE10 When I run this locally it works fine and sends the json successfully. However when I put this on another domain I get an "access is denied error" in IE.

Here is the json that I'm sending.

$.getJSON("http://somedomain.com/send?callback=?", {"name":name,"user":user},null);

Another strange occurance is that when I put this on a server any object that I pass json.stringify(obj); in the console returns "Access is denied". But if I pass console.log(obj); it returns the object successfully. But if I run the file locally I successfully return the json from json.stringify(obj);

I'm really really stumped on this any help or advice is greatly appreciated.

Thanks!

Delmon Young
  • 2,013
  • 5
  • 39
  • 51

2 Answers2

1

Sounds like a cross-domain-request issue.

You are unable to use getJSON() to fetch data from another site due to browser policies.

Check out this question for a workaround

Community
  • 1
  • 1
ddavison
  • 28,221
  • 15
  • 85
  • 110
1

Try it this way:

$.getJSON('http://somedomain.com/send?callback=?','name='+name'&user='+user,function(response){
    alert('response is ' + reponse);
});
Mark Schultheiss
  • 32,614
  • 12
  • 69
  • 100