I am trying to get some json data from the "remote" website. Then I launch my web service on port 99000, I launch my site on port 99001 (http: // localhost: 99001 / index.html).
I get the following message:
XMLHttpRequest cannot load http://localhost:99000/Services.svc/ReturnPersons. Origin http://localhost:99001 is not allowed by Access-Control-Allow-Origin.
Even if I run my webpage as an HTML file, I get the following:
XMLHttpRequest cannot load http://localhost:99000/Services.svc/ReturnPersons.Origin null is not allowed by Access-Control-Allow-Origin.
The web service returns data. I am trying to catch data items as follows:
var url = "http://localhost:99000/Services.svc/ReturnPersons"; $.getJSON(url, function (data) { success: readData(data) }); function readData(data) { alert(data[0].FirstName); }
And I'm trying to get this structure:
[{"FirstName":"Foo","LastName":"Bar"},{"Hello":"Foo","LastName":"World"}]
Do you know why I get this error?
json jquery cors cross-domain
Zakaria Sep 30 '10 at 8:31 2010-09-30 08:31
source share