How to load the content of a file into variable using jquery load method?

前端 未结 2 1519
闹比i
闹比i 2021-02-05 02:32

How do I load the content of a file into a variable instead of the DOM using jQuery .load() method?

For example,

$(\"#logList\").load(\"logF         


        
2条回答
  •  时光说笑
    2021-02-05 03:05

    load() is just a shortcut for $.get that atuomagically inserts the content into a DOM element, so do:

    $.get("logFile", function(response) {
         var logfile = response;
    });
    

提交回复
热议问题