My webserver's name is mybox.ourcorp.ourdomain.com
. From it I'm trying to make a json call to another server in the same subdomain--http://otherbox.ourcorp.ourdomain.com/feed
If I open a browser on my webserver and paste that URL in it I get json data back, no problem. but putting it into $.getJSON()
I get no value returned:
$.getJSON('http://otherbox.ourcorp.ourdomain.com/feed', function (json) {
storeDataFeed(json); //<----json is null
});
Is this a same-origin policy problem? I wouldn't think so, as they're in the same subdomain?
If so, does otherbox
have to be setup in some way to work with jsonp in order for me to go that route?
Is there a way to find out why that call to .getJSON
returns null? There are no messages in the browser console.
Yes, different subdomain would be considered a cross-domain request (http://en.wikipedia.org/wiki/Same_origin_policy#Origin_determination_rules).
But, you should be able to use $.ajax with dataType:"jsonp":
$.ajax({
dataType: "jsonp",
url: "http://otherbox.ourcorp.ourdomain.com/feed",
success:function(json) {
storeDataFeed(json); //<----json is null
}
});