当我尝试从http://api-v3.deezer.com/1.0/search/album/?q=beethoven&index=2&nb_items=2&output=json获取JSON 时:
(jQuery 1.6.2)
$.ajax({
type: "GET",
url: url,
dataType: "jsonp",
success: function (result) {
alert("SUCCESS!!!");
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.statusText);
alert(xhr.responseText);
alert(xhr.status);
alert(thrownError);
}
});
Run Code Online (Sandbox Code Playgroud)
我明白了: parsererror; 200; undefined; jquery162******************** was not called
但是使用http://search.twitter.com/search.json?q=beethoven&callback=?&count=5中的JSON 工作正常.两者都是有效的JSON格式.那么这个错误是什么?
[UPDATE]
@ 3ngima,我在asp.net中实现了这个,它运行正常:
$.ajax({
type: "POST",
url: "WebService.asmx/GetTestData",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
alert(result.d);
}
});
Run Code Online (Sandbox Code Playgroud)
WebService.asmx:
[WebMethod]
public string GetTestData()
{
try
{
var req = System.Net.HttpWebRequest.Create("http://api-v3.deezer.com/1.0/search/album/?q=beethoven&index=2&nb_items=2&output=json");
using (var resp …Run Code Online (Sandbox Code Playgroud)