ItSolutionStuff.com

How to Get Instagram Followers Count using JQuery?

By Hardik Savani • November 5, 2023
jQuery

Today, I am going to share with you how to retrieve number of followers, media, followed by you, username, profile picture, fullname etc by using jquery ajax. You can simply get count in your PHP Project or any php framework also like laravel, codeigniter, symfony etc.

When i was working on my php project and i require to get count total instagram followers of me. I did search a lot but i nothing get good on PHP, Finally i was thinking if it is possible by jquery ajax then it will be best. Again i search more and finally got something. In this solution we have to generate access token for out instagram profile details, Without token Instagram will never give you profile details so, First thing you have to get Token from bellow Link:

Generate Your Token:

Generate Instagram Token

Ok, After generate token, we will use it on our bellow example, So you have to assign bellow example code "token" variable, So let's follow bellow example and you can also check demo, After generate your token. In this example i just get total followers, but you can get also fullname, username, total number of media etc, you can check on demo.

index.html

<!DOCTYPE html>

<html>

<head>

<title>How to count Instagram Followers without authentication</title>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.js"></script>

</head>

<body>


<div class="container">

<h3>Total Follower : <strong class="instagram"></strong></h3>

</div>


<script type="text/javascript">


var token = '4161216023.1677ed0.431793ced855424ca3d8797f2394e983';


$.ajax({

url: 'https://api.instagram.com/v1/users/self',

dataType: 'jsonp',

type: 'GET',

data: {access_token: token},

success: function(data){

var follows = data['data']['counts']['follows'];

$(".instagram").text(follows);

},

error: function(data){

console.log(data);

}

});


</script>


</body>

</html>

You can get as response on data variable like as bellow preview:

Data variable response

{

"data": {

"website": "",

"username": "itsolutionstuff",

"profile_picture": "https://scontent.cdninstagram.com/t51.2885-19/s150x150/14566703_1220089754724188_3794670203778891776_a.jpg",

"id": "4161216023",

"bio": "",

"counts": {

"followed_by": 11,

"media": 2,

"follows": 2

},

"full_name": "Haresh Patel"

},

"meta": {

"code": 200

}

}

I hope it can help you...

Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

How to Split String to Array By Comma using JQuery?

Read Now →

How to Disable F5 Refresh Button using JQuery?

Read Now →

JQuery Rotate Image Animation Example Code

Read Now →

How to Remove All Spaces from String in JQuery?

Read Now →

PHP MySQL Confirmation Before Delete Record using Ajax Example

Read Now →

JQuery Reload Page After 5 Seconds Example

Read Now →

Laravel 11 JQuery Ajax Pagination Example

Read Now →

How to Get Number of Twitter Followers Count without API?

Read Now →

Laravel Instagram API Tutorial Example

Read Now →

Convert HTML to PDF in PHP with Dompdf Example

Read Now →

JQuery Animated Typing Effect using Typed JS Example

Read Now →

JQuery Email Autocomplete using Email-autocomplete JS

Read Now →

How to Add Lazy Loading Image using JQuery?

Read Now →

How to Remove Comma from String in JQuery?

Read Now →

JQuery Tooltip Example using JQuery UI Plugin

Read Now →