Javascript:禁止使用Dribble api的错误

Javascript:禁止使用Dribble api的错误,javascript,jquery,api,Javascript,Jquery,Api,不知道发生了什么,试图拉一个简单的图像 HTML JS $.getJSON(“http://api.dribbble.com/shots/popular?callback=?,函数(数据){ $('div')。追加(“”); }); 在控制台中,它会拉链接查找,但当我试图在页面上显示图像时,它会给我一个403。不知道我遗漏了什么。你遗漏了单引号 $('div').append('<img src="' + data.shots[0].image_url + '" />');

不知道发生了什么,试图拉一个简单的图像

HTML


JS

$.getJSON(“http://api.dribbble.com/shots/popular?callback=?,函数(数据){
$('div')。追加(“”);
});

在控制台中,它会拉链接查找,但当我试图在页面上显示图像时,它会给我一个403。不知道我遗漏了什么。

你遗漏了单引号

$('div').append('<img src="' + data.shots[0].image_url + '" />');
$('div')。追加(“”);
试试这个:

$.getJSON("http://api.dribbble.com/shots/popular?callback=?", function(data) {
  $('div').append('<img src="' + data.shots[0].image_url + '" />');
});
$.getJSON(“http://api.dribbble.com/shots/popular?callback=?,函数(数据){
$('div')。追加(“”);
});

如果需要,可以使用以下simples Javascript Dribbble API库:

您可以在此处看到一个示例:

其简单用途:

// get the most popular shots 
Dribbble.list( 'popular', function( response ){ 
   // write your code here 
});
谢谢,祝你好运

$.getJSON("http://api.dribbble.com/shots/popular?callback=?", function(data) {
  $('div').append('<img src="' + data.shots[0].image_url + '" />');
});
// get the most popular shots 
Dribbble.list( 'popular', function( response ){ 
   // write your code here 
});