I
I
Igor Fedorov2016-05-02 18:44:05
JavaScript
Igor Fedorov, 2016-05-02 18:44:05

How to get specific value from json file?

Hello
The link generates a json file https://www.googleapis.com/youtube/v3/channels?par...

How can I get a value from there using jquery, for example "subscriberCount"

THANK YOU VERY MUCH IN ADVANCE!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2016-05-02
@igor-fedorov

$.ajax({
  dataType: 'jsonp',
  url: 'https://www.googleapis.com/youtube/v3/channels?part=statistics&id=UCZmuh0rtKpxkbGsqPGg_skg&fields=items/statistics&key=AIzaSyA_hWf9rKcC9jMYpIVc_FkDLkp0CJ84opg',        
  success: function(data) {
   alert(data.items[0].statistics.subscriberCount);
  },
  error: function() {
    alert('error');
  }
});

https://jsfiddle.net/xayjf0kd/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question