1

I have a webapp running on a local Tomcat server that returns a file "foo" in JSON format. I have a webpage running on a local Apache server that needs to fetch some data. For testing, when navigate to

http://localhost:8080/foo/foo?function=bar 

in my browser, it works as intended and I get prompted to download the "foo" file (note that it doesn't have a .json extension and that I cannot(!) change that).

My call looks like this. It never alerts the "success" string.

$.getJSON("http://localhost:8080/foo/foo?function=bar", function(data) {
    alert("success!");
});

When I download the file in my browser, and put it in my local webpage's folder, and use the following call, it does work successfully:

$.getJSON("foo", function(data) {
    alert("success!");
});

Any help would be most welcome

1
  • 1
    Did you check if you're violating same-origin policy? Commented Sep 26, 2014 at 12:49

1 Answer 1

1

The answer was a violation of the same-origin policy.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.