What seems to be the problem calling the json api from a subdomain?
Asp.net MVC Action
[AllowAnonymous]
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
public JsonResult getBalances()
{
var balances = new[]
{
new {Id = 1, Balance = 3},
new {Id = 2, Balance = 2},
new {Id = 3, Balance = 1}
};
return Json(balances, JsonRequestBehavior.AllowGet);
}
jquery code
var url = "http://subdomain.mysite.com/getBalances/";
$.getJSON(url + '?callback=?', function (data) {
alert(data);
});
But the above script works if I used the twitter api url:
var url = "https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=twitterapi&count=2";
The json response is:
[{"Id":1,"Balance":3},{"Id":2,"Balance":2},{"Id":3,"Balance":1}]