尝试从url中获取JSON / JSONP数据并将结果显示在html网页上

When I enter the url for instance, "www.example.com" I get the return:

{
    shh: {
        id: 3730672,
        name: "Shh",
        profileIconId: 23,
        summonerLevel: 2,
        revisionDate: 1421646418000
    }
}

I am trying to get all this data and displaying it on my website that is HTML. I tried researching and even tried the following code,

$.getJSON('www.example.com', function(data){
    alert(data);
});

But it just displays nothing. Please help!

查看全部
duanbipu1720
duanbipu1720
2015/07/01 09:08
  • json
  • php
  • html
  • javascript
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

3个回复