Sean Fleming
Sean Fleming

Reputation: 121

I am trying to pull some data from a website I host, to another one

I am trying to pull some data from a website I host(we'll call it site A), to another one I'm putting up(Site B). I use $.getJSON to pull the data to site A. So when coding site B, I thought I could just call the json file directly to site B with this code.

$.getJSON("&&.&&.&&.50/ajaxdata/",function(data){
            document.getElementById("temp").innerHTML = data.temp;

&&.&&.&&.50 is the ip address of site A.

I don't get an error, but nothing shows up. What am I doing wrong?

Upvotes: 0

Views: 53

Answers (1)

Nicolas
Nicolas

Reputation: 818

Ajax request are subject to CORS (http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) for security reason.

You can make it work by configuring proper HTTP Headers on your ..*.50 server.

Upvotes: 1

Related Questions