Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 加载instagram api时出错_Javascript_Jquery_Html_Instagram Api - Fatal编程技术网

Javascript 加载instagram api时出错

Javascript 加载instagram api时出错,javascript,jquery,html,instagram-api,Javascript,Jquery,Html,Instagram Api,我想连接instagram api 我在我的项目中有以下页面: \index.html \js app.js jquery.js \css style.css myindex.html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Photo Search V2</title> <link rel="st

我想连接instagram api 我在我的项目中有以下页面:

\index.html
\js
   app.js
   jquery.js
\css
   style.css
myindex.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Photo Search V2</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
    <form id="form">
       <input type="text" id="search" />
    </form>
    <div id="instagram"></div>
    <footer>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/app.js"></script>
    </footer>
</body>
</html>
我不知道我在哪里犯了错误 如果可能的话,你看一下,告诉我哪里出错了
tnx很多

检查您是否收到任何响应..如何?请帮助我:)
回调(响应)
替换为
console.log(响应)
如果您收到一些响应,请检查代码我们有一个错误:提供的访问令牌无效。我解决了使用访问令牌的问题
 window.Instagram = {
    /**
     * Store application settings
     */
    config: {},

    BASE_URL: 'https://api.instagram.com/v1',

    init: function( opt ) {
        opt = opt || {};

        this.config.client_id = opt.client_id;
    },

    /**
     * Get a list of popular media.
     */
    popular: function( callback ) {
        var endpoint = this.BASE_URL + '/media/popular?client_id=' + this.config.client_id;
        this.getJSON( endpoint, callback );
    },

    /**
     * Get a list of recently tagged media.
     */
    tagsByName: function( name, callback ) {
        var endpoint = this.BASE_URL + '/tags/' + name + '/media/recent?client_id=' + this.config.client_id;
        this.getJSON( endpoint, callback );

    },

    getJSON: function( url, callback ) {
        $.ajax({
            type: 'GET',
            url: url,
            dataType: 'jsonp',
            success: function( response ) {
                if ( typeof callback === 'function' ) callback( response );
            }
        });
    }
};

Instagram.init({
    client_id: 'dbec7d28aef54180b9da9d52061c925b'
});


$( document ).ready(function() {

    Instagram.popular(function( response ) {
        var $instagram = $( '#instagram' );
        for ( var i = 0; i < response.data.length; i++ ) {
            imageUrl = response.data[i].images.low_resolution.url;
            $instagram.append( '<img src="' + imageUrl + '" />' );
}
    });

    $( '#form' ).on('submit', function( e ) {
        e.preventDefault();

        var tagName = $( '#search' ).val();
        Instagram.tagsByName(tagName, function( response ) {
            var $instagram = $( '#instagram' );
                $instagram.html('');

            for ( var i = 0; i < response.data.length; i++ ) {
                imageUrl = response.data[i].images.low_resolution.url;
                $instagram.append( '<img src="' + imageUrl + '" />' );
            }
        });

    });

});
TypeError: response.data is undefined