So, instead of ajaxSetup should I just use ajax, like the example? Now my code looks like this, but I’m receiving 400 (Bad Request).
jQuery(document).ready(function () {
jQuery.ajax({
type: ‘GET’,
url: ‘https://api.twitch.tv/kraken/streams’,
headers: {
‘Client-ID’: ‘xxx’
}
});
jQuery(’.ltwitch’).each(function () {
var tnick = jQuery(this).data(‘tnick’);
var span = jQuery(this);
jQuery.getJSON(“https://api.twitch.tv/kraken/streams/” + tnick, function © {
if (c.stream == null) {
span.removeClass("online");
} else {
span.addClass("online");
}
});
});
});
Can you show me an example of how can I add the headers on a proper way, on my code? (I really just know the basic off jQuery
)