jquery 我的webApp只显示列表中的第一个视频,其他的都不显示[已关闭]

kmbjn2e3  于 2022-12-12  发布在  jQuery
关注(0)|答案(1)|浏览(125)

**已关闭。**此问题为not reproducible or was caused by typos。目前不接受答案。

这个问题是由一个打字错误或一个无法再重现的问题引起的。虽然类似的问题在这里可能是on-topic,但这个问题的解决方式不太可能帮助未来的读者。
1小时前关闭。
Improve this question
这是我的方法得到所有的视频

function getVideos(){

//Replace the current HTML in that div with a loading message
$('#VideoList').html('<div class="spinner-border" role="status"><span class="sr-only"> &nbsp;</span>');

$.getJSON(RAI, function( data ) {
  //Create an array to hold all the retrieved assets
  var items = [];
  alert(JSON.stringify(data))
    //Iterate through the returned records and build HTML, incorporating the key values of the record in the data
    $.each( data, function( key, val ) {

      items.push( "<hr />");
      items.push("<video width='320' height='240' controls>")
      items.push("<source src='"+BLOB_ACCOUNT + val["FilePath"] +"'  type='video/mp4' <br/>")
      items.push( "Movie title: " + val["MovieTitel"] + "<br />");
      items.push( "Genre: " + val["Genre"] + "<br />");
      items.push( "Uploaded by: " + val["UserId"] + "<br />");
      items.push( "<hr />");

    });

    //Clear the assetlist div
    $('#VideoList').empty();

    //Append the contents of the items array to the VideoList Div
    $( "<ul/>", {
      "class": "my-new-list",
      html: items.join( "" )
    }).appendTo( "#VideoList" );
  });

}

这是在声明列表项之后由上面使用的alert方法调用的数据的格式。
(出于隐私原因,我替换了一些值,它们不是重复值)

[{"MovieId":"SOMESTRINGID","UserId":"test@email.com","MovieTitel":"test all api","Genre":"Funny","FilePath":"/video/XXXXXXXXXX"},{"MovieId":"SOMESTRINGID","UserId":"ginger@hotmail.com","MovieTitel":"Gingerites","Genre":"undefined","FilePath":"/video/XXXXXXXXXX"},
{"MovieId":"SOMESTRINGID","UserId":"test@email.com","MovieTitel":"Movie short","Genre":"undefined","FilePath":"/video/XXXXXXXXXX"},
{"MovieId":"SOMESTRINGID","UserId":"test@email.com","MovieTitel":"Movie short","Genre":"undefined","FilePath":"/video/XXXXXXXXXX"}]

我使用了alert方法来确保API工作正常。
I found out that the info was successfully past to the html form and that all the other videos are nested inside the first video. the html form also doesn't show any additional info like the genre or movie title of even the first vid. lots of clues but too stupid to piece it together, sorry about that

相关问题