Twitch TV help with jQuery

Hey guys. Been on the twitch project for a while, just because I haven’t had the time to work on it. Now that I’m back, I’ve hit a mental block. I’ve styled the app how I’d like, (Whenever you hover over a button it displays a message) however, I can’t figure out what the best way would be to display the information from my AJAX/JSON call.

Please, someone, have a look. I’d appreciate any advice. Also… Don’t worry that there isn’t any Ajax/JSON: I’m working on it.

Twitch TV

I advise including HandlebarsJS in your workflow. It’s going to simplify things a lot, allowing you to write all of your markup in HTML instead of in your JavaScript. Here’s a recent video tutorial that I think covers the topic well:

You’ll have to change around some of the syntax you use since you’re using jQuery and this guy’s on vanilla JS. You can skip using the XHR object, of course, as you’ve already got $.ajax working. Instead of document.getElementById().innerHTML, you can use $().html() because jQuery is awesome like that. Also, HTML has a <template> tag for just this sort of thing, which he’s not using for some reason. Use that instead of <script type="text/x-handlebars-template">.

1 Like

Got it. Thanks a lot!