www.example.com/page_a/www.example.com/page_b/にあるファイル内で「hello」というテキストを検索するjavascriptコードを実行することは可能ですmy_file.txt?javacriptを使用してtxtファイル内を検索する
これはjavascript/jquery /他のjavascriptフレームワークで可能ですか?
www.example.com/page_a/www.example.com/page_b/にあるファイル内で「hello」というテキストを検索するjavascriptコードを実行することは可能ですmy_file.txt?javacriptを使用してtxtファイル内を検索する
これはjavascript/jquery /他のjavascriptフレームワークで可能ですか?
を使用してみてくださいはい、それは可能であり、それはjQueryを使って最も簡単です。
$.get("www.example.com/page_b/my_file.txt", function(contents){
//contents variable now contains the contents of the textfile as string
//check if file contains the word Hello
var hasString = contents.includes("Hello");
//outputs true if contained, else false
console.log(hasString);
})
:あなたはこのようなテキストファイルの内容を「取得」する必要が
はjqueryの$に.get()
$.get("text file path",function(textString) {
// handle the returned string ..
},"text/plain")