The Instagram API seems to be experiencing some technical difficulties

My expertise lies primarily in HTML/CSS, with limited knowledge of using APIs and JavaScript.

I have been assigned the task of utilizing an API to retrieve Instagram pictures posted by users with a specific hashtag.

Here is the demo shared via JSFiddle: http://jsfiddle.net/j9ynxvox/10/

$(function() {
  // When "Display" button is clicked, images will be retrieved
  var endpoint = 'https://tagplus.jp/demo/api/json/medias';

  // Function for displaying popup
  var popup = function(item) {
    var $container = $('<div>', {'class': 'popup-container'});
    $('<div>', {'class': 'popup-overlay'}).appendTo($container);

    var $template = $($('#popup-template').html());
    $template.find('.popup-image').attr('src', item.images.standard_resolution);
    var userLink = 'https://instagram.com/' + item.media_user.username;
    $template.find('.user-link').attr('href', userLink);
    $template.find('.profile-picture')
             .attr('src', item.media_user.profile_picture);
    $template.find('.media-user-name').text(item.media_user.username);
    $template.appendTo($container);

    $('body').append($container);
    $container.fadeIn();
  };

  $(document).on(
    'click',
    '.popup-overlay',
    function(e) {
      e.preventDefault();
      $('.popup-container').fadeOut(
        'fast',
        function() {
          $(this).remove();
        }
      );
    }
  );

  $('button').click(function() {
    $('#thumbnail').text('');
    $.get(
      endpoint,
      {count: 12},
      function(res) {
        res.data.forEach(function(item) {
          var $thumb = $('<img>', {
            'class': 'insta-thumb',
            src: item.images.thumbnail
          });
          $thumb.appendTo($('#thumbnails'));
          $thumb.click(function(e) {
            e.preventDefault();
            popup(item);
          });
        });
      },
      'jsonp'
    );
  });

  $(document).keyup(function(e) {
    if (e.keyCode === 27) {
      $('.popup-container').fadeOut(
        'fast',
        function() {
          $(this).remove();
        }
      );
    }
  });
});

I have been instructed to use this specific API address: (referred to as )

Initially, I copied and pasted the JSFiddle code into my local files, but encountered issues when attempting to load Instagram pictures by clicking the button.

Here is my demo: (ID: test, Password: ny2016)

I am seeking assistance in understanding why it is not functioning and how I can resolve this issue.

Thank you for your time!

Answer №1

UPDATE: It seems that your script is completely different from the one provided in the fiddle. Swap out your script for the one in the fiddle and give it another shot!


Previous response:

The reason it's not working is because you are missing jQuery!

Insert this code in the head section of your HTML and try again:

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Angular2 Animation for basic hover effect, no need for any state change

Can anyone assist me with ng2 animate? I am looking to create a simple hover effect based on the code snippet below: @Component({ selector: 'category', template : require('./category.component.html'), styleUrls: ['./ca ...

Creating a Custom Form Control in Angular 2 and Implementing Disable Feature

I have developed a unique custom control using ControlValueAccessor that combines an input[type=text] with a datepicker. While the template-driven forms accept it without any issues, the situation changes when implementing the model-driven approach (react ...

Finding distinct values in a multidimensional array using JavaScript

When working with JavaScript, I created a multidimensional array using the following code: result.each(function(i, element){ init.push({ label : $(this).data('label'), value : $(this).val(), }); }); The resulting array in ...

How to Display Prices in Euros Currency with Angular Filter

Can someone help me figure out how to display a price in euros without any fractions and with a dot every 3 digits? For example, I want the price 12350.30 to be shown as 12.350 €. I attempted to use the currency filter but it only worked for USD. Then ...

Output the result of a PHP script inside a JavaScript code

I'm having trouble getting the code below to display the success word. Can anyone spot what's wrong with it? Appreciate any help in advance. <script type="text/javascript"> function verification(){ var s = document.test_form.textfiel ...

Jackson JSON, selecting specific fields based on their path

Is there a way to dynamically filter bean properties during serialization without using the @JsonView annotation? Let's say we have a Bean represented in JSON notation: { id: '1', name: 'test', children: [ { id: &a ...

Modify the behavior of the tab key using JavaScript

I'm currently working on a text editor embedded within a contenteditable div. My goal is to modify the [TAB] functionality so that instead of shifting focus to the next element (as is done by default in browsers), it will either insert spaces or a &b ...

The absence of FormData.entries in submit is a limitation of the Vue framework

I recently created a Vue-App that consists of a simple form with just one <input name"surname"> and a <button type="submit">. The use case is to input "myname" and submit the form. However, when I initialize new FormData( ...

Selenium Python not generating event when clicking on element (Key event missing from datafile)

One issue I am facing is that clicking on a button element does not trigger the event. Specifically, while attempting to add an item to the cart, a size must be selected before clicking the "add to cart" button. This problem occurs when using the Chrome he ...

Encountering an "Unexpected token '{'" error while attempting to import chart.js is likely due to the import call expecting only one argument

I'm currently working on a node.js app that utilizes chart.js for visualizations. However, I'm running into errors when trying to import and use Chart. To serve chart.js to the client, I used npm to install it and then added the following code: ...

Using Vue along with bootstrap-vue: Ensuring only one list element is expanded in a list (v-for) at any given time

In my Vue project with bootstrap-vue, I am utilizing the b-collapse feature within a v-for loop for lists. While it is functioning correctly, I am struggling to automatically close expanded list elements when a new one is clicked. Here is my question: Ho ...

Tips for utilizing the Hook API design pattern

I'm currently learning how to customize Material UI components. The tutorial provides the following Hook API code: import React from 'react'; import { makeStyles } from '@material-ui/core/styles'; import Button from '@materia ...

Guide on how to perform a POST request within a service worker?

I am faced with the challenge of sending a POST request to the back-end every time a client clicks on a Push notification from the front-end, in order to confirm that the client has received the notification. Here is the system I currently have in place f ...

Why is Component scope not binding in AngularJS?

I encountered a problem and have set up a JSFiddle to showcase var myApp = angular.module("myApp", []); myApp.component("bar", { transclude: true, template: '<div ng-transclude></div>', controller: function ($scope, $elem ...

The access to the HTTP request has been restricted

Currently, I am developing multiple applications that need to communicate with each other. To test these apps, I am using both Chrome and Firefox browsers. Strangely, the issue persists in both browsers. The issue at hand: In one of my applications (let& ...

Get started by setting up and utilizing react version 0.14.0 on your

I'm currently facing an issue in my project while using react-0.14.0. The error message I'm encountering is: Invariant Violation: ReactDOM.render(): Invalid component element. This may be caused by unintentionally loading two independent copie ...

Pass a Json object as a parameter to a Web Api controller in a .NET Core application

This code snippet utilizes Google API with Javascript var output = new Object(); output.PlaceID = place.place_id; output.Longitude = place.geometry.location.lng(); output.Latitude = place.geometry.location.lat(); $.ajax({ headers: { 'Acc ...

Having trouble with the "initSdk" property being undefined in your React Native Appsflyer integration?

I'm currently facing an issue while trying to integrate AppsFlyer into a react native application. The error I am encountering is "Cannot read property 'initSdk' of undefined" Initially, I imported the react-native-appsflyer module as shown ...

Modify the Div background color by accessing the HEX value saved in a JSON file

(I made a change to my code and removed the br tag from info2) Currently, I have successfully implemented a feature using jQuery that reads color names and hex values from a JSON file, populates them in a drop-down select menu (which is working fine). Now ...

Tips for creating a console.log wrapper specifically designed for Angular2 using Typescript

Is there a way to create a custom global logging function in Angular 2 TypeScript project that can be used instead of console.log for services and components? I envision the function looking like this: mylogger.ts function mylogger(msg){ console.log ...