Answer the question
In order to leave comments, you need to log in
The request to the Instagram API from the body of the page does not pass. How to fix?
For learning purposes, I decided to make a simple web application that works with the Instagram API. The bottom line is this: by clicking on the button, an ajax request is made to the API and photos are displayed. I registered in Instagram itself, connected the application.
Here is the code trying to get at least something from the API:
var config = {};
config.Beget = {
apiKey: 'xxx', // Здесь реальные данные из панели разработчика Instagram
clientID: 'xxx', // Здесь реальные данные из панели разработчика Instagram
apiHost: 'https://api.instagram.com/'
};
$('.submit').click( // submit - класс кнопки-тригера
function getData() {
var tag = 'snow'; // Определил здесь тег, по которому будет идти поиск, в целях упрощения дебага.
var url = config.Beget.apiHost + 'v1/tags/' + tag + '/media/recent?access_token=' + config.Beget.apiKey;
$.ajax({
dataType: 'jsonp',
cache: false,
url: url,
headers: {
'Access-Control-Allow-Origin': '*'
},
success: function(result) {document.write('REQUEST SENT: ' +result.data[0].type)},
error: function(){console.log('Error!');}
});
}
);
});
Answer the question
In order to leave comments, you need to log in
I don't see you turning off the standard form submit via event.preventDefault();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question