为什么我不能从网址中获取json对象

Mat*_*iby 1 javascript jquery json web-services

我有这个网址,它带回了雅虎的时间......我猜这个PST

所以我需要用javascript获取这个值...这是我的代码

$j.ajax({
    type: "GET",
    url: "http://developer.yahooapis.com/TimeService/V1/getTime?appid=YahooDemo&output=json",
    dataType: "jsonp",
    complete: function(data){
      console.log(data);
      }
  });
Run Code Online (Sandbox Code Playgroud)

但我似乎无法将时间戳从json中拉出来......我做错了什么

Mor*_*gon 5

您正在使用该complete方法,该方法返回XHR对象,而不是结果.
你想要success:

$j.ajax({
    type: "GET",
    url: "http://developer.yahooapis.com/TimeService/V1/getTime?appid=YahooDemo&output=json",
    dataType: "jsonp",
    success: function(data){
      console.log(data.Response.Timestamp);
    }
});
Run Code Online (Sandbox Code Playgroud)

资料来源:http://api.jquery.com/jQuery.ajax/