Как изменить список URL-адресов YouTube (ссылки) с https://www.youtube.com/watch?v= .... на https://www.youtube.com/embed?v= ... динамически в Jquery, я новичок в html с jquery, пожалуйста, сообщите мне код.
моя js страница:
function vidgallerylist(){
var url=path+"/customer/video";
$.ajax({
type: "GET",
url: url,
success: function(result) {
console.log(result);
for(var i=0;i<result.data.length;i++){
$('#vidlistshow').html(function(i,url){
var url = result.data[i].vidgalleryUrl;
var id = url.split('watch?v=')[2];
$("#tablevidgalleryid").append('<tr><td>'+result.data[i].vidgalleryTitle+'</td><td><iframe width="380" height="258" src="http://www.youtube.com/embed/' + id + '" frameborder="0" allowfullscreen></iframe></td></tr>');
});
}
$('#tablevidgalleryid').DataTable();
}
});
}
html страница:
<h2>List of Video Gallery</h2>
<table class="table " id="tablevidgalleryid">
<thead>
<tr>
<th>Title</th>
<th>Videos url</th>
</tr>
</thead>
<tbody id="vidlistshow">
</tbody>
</table>
</div>
На странице моего браузера показано ниже:
