Javascript读取文件
嗨,我希望有人能帮我: 我创建了一个bash脚本,通过FTP连接到我的免费网络主机,并上传一个file.txt文件 进入主目录。我想做的是阅读此文本并将其显示在index.html网站上 环顾四周,我看到了以下脚本:Javascript读取文件,javascript,jquery,html,Javascript,Jquery,Html,嗨,我希望有人能帮我: 我创建了一个bash脚本,通过FTP连接到我的免费网络主机,并上传一个file.txt文件 进入主目录。我想做的是阅读此文本并将其显示在index.html网站上 环顾四周,我看到了以下脚本: jQuery.get('path/to/file/on/server.txt', null, function(data, status) { // your file contents are in 'data' }); 如何输出“数据” 或者有没有其他方法可以推荐 多
jQuery.get('path/to/file/on/server.txt', null, function(data, status) {
// your file contents are in 'data'
});
如何输出“数据”
或者有没有其他方法可以推荐
多谢各位
$.get("file.txt", function(data){
alert("Data Loaded: " + data);
});
编辑:取自
编辑:取自获取file.txt的内容并显示在id为“id”的div中:
获取file.txt的内容并显示在id为“id”的div中:
$.get("file.txt", function(data){
$("#id").text(data);
});