<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<style>
</style>
<title>read file</title>
</head>
<script src="jquery-1.11.2.js"></script>
<script>

            $(function() {
                $("#btn1").click(function(){
                    $.ajax({
                        type: "get",
                        url: "1.txt",
                        dataType: "text",
                        async: true
                    }).done(function (data) {
                        $("#one").html(data.replace(/\r\n/ig, '</br>'));//替换回车行成换行符
                        //console.log(data.replace(/\r\n/ig,'</br>'));
                    });
                });
            });
        </script>
    <body>
        <div >
        </div>
        <input type="button" />
    </body>
</html>

 

相关文章:

  • 2022-12-23
  • 2021-05-28
  • 2021-11-27
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
  • 2021-06-28
  • 2022-12-23
猜你喜欢
  • 2021-06-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
  • 2022-12-23
  • 2021-09-05
相关资源
相似解决方案