我真的需要一些帮助。
<div id="entrylist"></div>
var urlSource = "http://www.example.com/catgories=Cat1,Cat,2,Cat3";
$.getJSON(urlSource, function(data){
$.each(data, function(i,entry){
if(entry.LiveStatus == 3) {
content = '<div class="row filmate">';
content += '<div class="large-4 columns no-padding">';
content += '<a href="#" onclick="playVideo('' + entry.VideoStreamUrl + '')"><img src="' + entry.ThumnailUrl + '" /></a><p>' + entry.Viewers + '<img src="img/eyes.png" /></p>';
content += '</div>';
content += '<div class="large-8 columns no-padding">';
content += '<h2>' + entry.Title + '</h2>';
content += '</div>';
content += '</div>';
} else if(entry.LiveStatus == 2) {
content = '<div class="row filmate">';
content += '<div class="large-12 columns no-padding">';
content += '<h2>' + entry.Title + '</h2>';
content += '</div>';
content += '<div class="large-12 columns no-padding">';
content += '<a href="#" data-reveal-id="myModal"><img id="ls-3" src="' + entry.ThumnailUrl + '" /></a><p>' + entry.Viewers + '<img src="img/eyes.png" /></p>';
content += '</div>';
content += '</div>';
} else if(entry.LiveStatus == 1) {
content = '<div class="row filmate">';
content += '<div class="large-12 columns no-padding">';
content += '<h2>' + entry.Title + '</h2>';
content += '</div>';
content += '<div class="large-12 columns no-padding">';
content += 'in direct<img src="' + entry.ThumnailUrl + '" /><p>' + entry.Viewers + '<img src="img/eyes.png" /></p>';
content += '</div>';
content += '</div>';
} else {
content = '<div class="row planificat">';
content += '<div class="large-12 columns planned no-padding">';
content += '<h2>' + entry.Title + '</h2>';
content += '<p>planificat</p>';
content += '</div>';
content += '</div>';
};
$(content).appendTo("#entrylist");
});
});
这是我的 JSON 获取和发布代码。请给我一个提示:
- 选中复选框时,将类别附加到 urlSource 变量。
- 选中该复选框后,重新加载 JSON 并显示新选项
先感谢您!