I wanted to display a message inside a div
tag when there is no images returned using instafeed
. I'm using the instafeed library and checked the instafeed.js
and I saw error messages like No images were returned from Instagram
how can I display it in my Html?
Here's my html code
<div class="col-md-8">
<h4>Photos</h4>
<div id="instafeed"></div>
<div class="clearfix"></div>
</div>
and my javascript
<script src="<?php echo base_url()?>js/instafeed.min.js"></script>
<script type="text/javascript">
var feed = new Instafeed({
get: 'tagged',
tagName: 'awesome',
resolution: 'low_resolution',
clientId: CLIENT_ID,
userId: USER_ID,
accessToken: ACCESS_TOKEN,
useHttp: true,
template: '<a href="{{link}}"><img src="{{image}}"/></a>'
});
feed.run();
</script>
In my html code I added a <p> tag
and put an id
<p id="error"></p>
And then in my JS i added error
option
<script type="text/javascript">
var feed = new Instafeed({
......
error: function(err){
$('#error').text(err);
}
});
feed.run();
</script>