$(document).ready(function () { initList("."); }); function initList(dir) { $.ajax({ url: "./script/php/video/getDir.php", type: "POST", data: { dir: dir, }, dataType: "json" }).done(function (result) { $("#video-list").empty(); dir_names = result["dir_names"]; file_tables = result["file_tables"]; if (result["parent"] != undefined) parent = result["parent"]; //directory for (i = 0; i < dir_names.length; i++) { $("#video-list").append('
' + '
' + "" + '' + '' + '' + '
' + '
'); } //video for (j = 0; j < file_tables.length; j++) { if (file_tables[j]["file_path"].includes(".m3u8")) { $("#video-list").append('
' + '
' + "" + '' + '' + '' + '' + '
' + '
'); } } }).error(function (error) { console.log(error); }); } function getVideo(id) { $.redirect('./video-play.php', { 'id': id }); }