Pass values from a JSON to the html via Jquery


I'm trying to get the data from the JSON of the twitch and manipulate them in html, in case I wanted to put together a simple list with the online channels, using the alert it shows the channels but I thought to print the list in a ul, li without having to deal with html. Can someone tell me a way to do this?

 type : "GET",
 dataType : "jsonp",
 url : "",
 success: function(data){
asked by anonymous 06.01.2015 / 17:49

1 answer


I believe that by "without touching html" you mean putting the content on the page via javascript, right?

// transforme a lista no que você precisa (lista de li):
var listaDeLi = {
    return "<li>" + elemento._links.self + "</li>";

// coloque o conteúdo gerado em algum lugar
$('#content').append("<ul>" + listaDeLi.join('') + "</ul>");
06.01.2015 / 18:02