# Cant get viewers and picture JAVASCRIPT

**URL:** <https://discuss.dev.twitch.com/t/cant-get-viewers-and-picture-javascript/7558>\
**Category:** API\
**Created:** [September 23, 2016, 5:45pm UTC](https://discuss.dev.twitch.com/t/cant-get-viewers-and-picture-javascript/7558 "2016-09-23T17:45:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![wantedjk](https://avatars.discourse-cdn.com/v4/letter/w/a9adbd/32.png) [@wantedjk](https://discuss.dev.twitch.com/u/wantedjk)\
**Post date:** [September 23, 2016, 5:45pm UTC](https://discuss.dev.twitch.com/t/cant-get-viewers-and-picture-javascript/7558/1 "2016-09-23T17:45:18Z")

</div>

Hello , can some body help me with this code?  
I was use this code before , but now it`s not work as I understand becouse I need to add Client ID…

I have tried to add Client Id like this  
$.getJSON("[https://api.twitch.tv/kraken/channels/esl\_csgo.json?client\_id=client\_id?callback=?"](https://api.twitch.tv/kraken/channels/esl_csgo.json?client_id=client_id?callback=?%22),

---

<div class="post-metadata">

**Author:** ![martmists](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@martmists](https://discuss.dev.twitch.com/u/martmists)\
**Post date:** [September 23, 2016, 6:29pm UTC](https://discuss.dev.twitch.com/t/cant-get-viewers-and-picture-javascript/7558/2 "2016-09-23T18:29:17Z")

</div>

Try:  
`$.getJSON("https://api.twitch.tv/kraken/channels/esl_csgo?client_id=YOUR_CLIENT_ID")`

---

<div class="post-metadata">

**Author:** ![wantedjk](https://avatars.discourse-cdn.com/v4/letter/w/a9adbd/32.png) [@wantedjk](https://discuss.dev.twitch.com/u/wantedjk)\
**Post date:** [September 23, 2016, 7:29pm UTC](https://discuss.dev.twitch.com/t/cant-get-viewers-and-picture-javascript/7558/3 "2016-09-23T19:29:40Z")

</div>

This is my original code , for example (esl\_csgo)

div id=“SHOWDIV”\>\</div

function showImage(d){  
alert(d.logo);}  
$.getJSON("[https://api.twitch.tv/kraken/channels/esl\_csgo.json?callback=?"](https://api.twitch.tv/kraken/channels/esl_csgo.json?callback=?%22), function(d){document.getElementById(“SHOWINDIV”).innerHTML += ‘

’;});

So I edit it to

function showImage(d){  
alert(d.logo);}  
$.getJSON("[https://api.twitch.tv/kraken/channels/esl\_csgo?client\_id=MY\_CLIENT\_ID?callback=?"](https://api.twitch.tv/kraken/channels/esl_csgo?client_id=MY_CLIENT_ID?callback=?%22), function(d){document.getElementById(“SHOWINDIV”).innerHTML += ‘

’;});

---

<div class="post-metadata">

**Author:** ![3ventic](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/3ventic/32/298_2.png) [@3ventic](https://discuss.dev.twitch.com/u/3ventic)\
**Post date:** [September 23, 2016, 8:00pm UTC](https://discuss.dev.twitch.com/t/cant-get-viewers-and-picture-javascript/7558/4 "2016-09-23T20:00:37Z")

</div>

? starts the url params, which are separated by &, change the ? between the client id and callback in your request url.

---

<div class="post-metadata">

**Author:** ![DallasNChains](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dallasnchains/32/1608_2.png) [@DallasNChains](https://discuss.dev.twitch.com/u/DallasNChains)\
**Post date:** [September 23, 2016, 8:01pm UTC](https://discuss.dev.twitch.com/t/cant-get-viewers-and-picture-javascript/7558/5 "2016-09-23T20:01:31Z")

</div>

Read up on query string parameters and how to pass multiple. Your query string is malformed currently.

> <https://stackoverflow.com/questions/724526/how-to-pass-multiple-parameters-in-a-querystring>

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [October 23, 2016, 8:01pm UTC](https://discuss.dev.twitch.com/t/cant-get-viewers-and-picture-javascript/7558/6 "2016-10-23T20:01:35Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
