ディレクトリとどのようにテキストファイルをロードするためのすべての画像をロードする方法には、いくつかの類似したSOの質問があります。これが適応されます。
HTML:
<div id='foundTexts'>
<ul>
</ul>
</div>
JSを:
var directory = 'texts/';
$.ajax({
//This will retrieve the contents of the folder if the folder is configured as 'browsable'
url: directory,
dataType: "text",
success: function (data) {
//List all txt file names
$(data).find("a:contains(.txt)").each(function (i) {
// find the new file url of each txt file
var newFileLocation = directory+$(this).text().substring(1);
$.get(newFileLocation, function(response) {
// loads the content of each file, inserts into a list item and appends to an unordered list
$("#foundTexts ul").append('<li>'+ response +'</li><br>');
});
});
}
});
サーバーのフォルダを確認してくださいブラウズ可能になるように構成され、あなたは右のフォルダの場所へdirectory
変数が設定されていることあなたのテキストファイル用。
レーヨンはそうです、あなたがしたことを私たちに見せてください。 +理解していると、HTMLページの同じフォルダにある各TXTファイルを表示したいのですか?またはあなたが選んだ人だけ? – Aks
Rayonが言ったように、あなたが今まで行ってきたことのいくつかのコードを提供してください。あなたの環境がどのように見えるかによって、これに対する解決策がたくさんあります。 –