开发者

$.getJSON to receive JSON from API URL

Hey I've done about as much research as I can and can't figure out my issue, if anyone could help me out.

Basically have a API set up leading to a JSON doc and something seems to be hanging up the URL and this is what I'm working with so far

$(document).ready(function () {
    $('#submit').click(function () {
        $.getJSON('http://localhost:41387/api/v0/9405503699300197435172',
            function (json) {
                console.log(json);
            }
        );
    });
});

I'm taking that the request is being made and completed, but I'm not getting a response.

I kn开发者_StackOverflow社区ow it can't be the code because I used a twitter search URL and got back a response.

There are no errors or exceptions being thrown in the server code.

Any help would be appreciated.


From reading your question and comments, I think the reason it works when you use JSONP, might have to do with cross-domain restriction set by the browser.

Make sure the page where you run ajax calls and the ajax URL are on the same domain. In this case, they both need to be on "http://localhost" domain name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜