jQuery的AJAX:无效的标签标签、jQuery、AJAX

2023-09-10 21:26:29 作者:纠结、玩不起°。

我的code:

$.ajax({
        url: 'http://tinysong.com/b/Beethoven?format=json&key=<my key..>',
        dataType: 'jsonp',
        success: function(response) {
            console.log(response);
        }
    });

萤火虫说:无效的标签。但是,当我访问的网址在浏览器中,我看到:

Firebug says "invalid label". But when i visit the url in my browser, i see:

{"Url":"http:\/\/tinysong.com\/7Wm7","SongID":8815585,"SongName":"Moonlight Sonata","ArtistID":1833,"ArtistName":"Beethoven","AlbumID":258724,"AlbumName":"Beethoven: Piano Sonatas"}

看起来像一个corret JSON字符串给我。我失去了一些东西?谢谢!

Looks like a corret json-string to me. Am i missing something? Thanks!

推荐答案

这是JSON。你问一个JSONP字符串中的数据类型时,这将需要您的输出被包裹在一个函数。

That's JSON. You're asking for a JSONp string in the dataType, which would require your output to be wrapped in a function.

 
精彩推荐
图片推荐