Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 javascript 的新手,在读取服务器上的文本文件时遇到问题——
我建议进行 ajax 调用并读取数据。由于您是 javascript 新手,我会添加 jQuery 库并使用它的 ajax 命令。此外,稍后研究对代码进行命名空间以使 javascript 脱离全局范围,但这是一个单独的大对话。
$.ajax({ url: url, data: data, success: function(data){fileData=data;}, dataType: dataType });