0
www.example.com/page_a/www.example.com/page_b/에 위치한 파일에서 "hello"텍스트를 검색하는 자바 스크립트 코드를 실행할 수 있습니다. my_file.txt?자바 스크립트를 사용하여 txt 파일 내에서 검색
이것은 javascript/jquery/다른 자바 스크립트 프레임 워크에서 가능합니까?
www.example.com/page_a/www.example.com/page_b/에 위치한 파일에서 "hello"텍스트를 검색하는 자바 스크립트 코드를 실행할 수 있습니다. my_file.txt?자바 스크립트를 사용하여 txt 파일 내에서 검색
이것은 javascript/jquery/다른 자바 스크립트 프레임 워크에서 가능합니까?
예, 그것은 가능하고 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);
})
: 당신은 텍스트 파일의 내용과 같이 "GET"필요
에 한번 사용 JQuery와 $의 갔지()
$.get("text file path",function(textString) {
// handle the returned string ..
},"text/plain")