<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script type="text/javascript">
var xhr = $.get("http://api.giphy.com/v1/gifs/search?q=ryan+gosling&api_key=dc6zaTOxFJmzC&limit=5");
xhr.done(function(data) { console.log("success got data", data); });
</script>
This is the response body from giphy:
的价值答案 0 :(得分:1)
你几乎就在那儿......你为什么要开始身体?检查working example
var xhr = $.get("https://api.giphy.com/v1/gifs/search?q=ryan+gosling&api_key=dc6zaTOxFJmzC&limit=5");
xhr.done(function(data) {
console.log( data.data[0].images.fixed_height.url);
});
答案 1 :(得分:0)
请尝试以下代码
Xhr.done (function (data) {<br>
Console.log ("success got data", data);<br>
// How to check with log<br>
Console.log (data [0] .images.fixed_height.url + "");<br>
});
答案 2 :(得分:0)
从你的printcreen你需要为网址安装以下内容:
console.log( data.data[0].images.fixed_height.url);
演示:https://jsfiddle.net/a2Lfg20g/
第一个data
是响应主体,第二个data
是来自响应主体的对象数组
答案 3 :(得分:0)
试试这个:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script type="text/javascript">
var xhr = $.get("http://api.giphy.com/v1/gifs/search?q=ryan+gosling&api_key=dc6zaTOxFJmzC&limit=5");
xhr.done(function(data) { console.log("success got data", data.data[0].images.fixed_height.url); });
</script>