I'm a server-side programmer with only basic web experience so I don't know how to accomplish the following task.
我是一名服务器端程序员,只有基本的网络经验,所以我不知道如何完成以下任务。
I am reading several files simultaneously across a network and merging all the data into a single file. Typically these will be log files but they may be some other sort of text file. Some fancier indexing, searching, sysloggy stuff is going on but that's beside the point.
我正在通过网络同时读取多个文件,并将所有数据合并到一个文件中。通常这些将是日志文件,但它们可能是其他类型的文本文件。一些发烧友索引,搜索,sysloggy的东西正在进行,但这是重点。
I'd like to write a basic web interface which will allow the user to view this concatenated file in real-time. I know this will involve some ajaxy javascript dhtml type of stuff, I just dont know exactly what that is and I dont know where to start looking for information other than 'web programming basics' and I'm a little further along than that. Thanks!
我想编写一个基本的Web界面,允许用户实时查看这个连接文件。我知道这将涉及一些ajaxy javascript dhtml类型的东西,我只是不知道究竟是什么,我不知道从哪里开始寻找除“网络编程基础”之外的信息,我还有点远。谢谢!
1 个解决方案
#1
0
You can use ajax to fetch data from either xml/text file.
您可以使用ajax从xml / text文件中获取数据。
If you have any content stored in a text file the following code will work
如果您在文本文件中存储了任何内容,则以下代码将起作用
Example code
示例代码
<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML= xmlhttp.responseText;
}
}
xmlhttp.open("GET","ajax_info.txt",true);
xmlhttp.send();
}
</script>
<div id="myDiv">Let AJAX change this text</div>
<button type="button" onclick="loadXMLDoc()">Change Content</button>
View the live example at http://www.w3schools.com/Ajax/tryit.asp?filename=tryajax_first
在http://www.w3schools.com/Ajax/tryit.asp?filename=tryajax_first查看实时示例
View the sample for getting xml data using ajax, http://www.w3schools.com/Ajax/ajax_xmlfile.asp
使用ajax查看获取xml数据的示例,http://www.w3schools.com/Ajax/ajax_xmlfile.asp
You can further read about ajax from here
您可以从这里进一步阅读有关ajax的信息
#1
0
You can use ajax to fetch data from either xml/text file.
您可以使用ajax从xml / text文件中获取数据。
If you have any content stored in a text file the following code will work
如果您在文本文件中存储了任何内容,则以下代码将起作用
Example code
示例代码
<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML= xmlhttp.responseText;
}
}
xmlhttp.open("GET","ajax_info.txt",true);
xmlhttp.send();
}
</script>
<div id="myDiv">Let AJAX change this text</div>
<button type="button" onclick="loadXMLDoc()">Change Content</button>
View the live example at http://www.w3schools.com/Ajax/tryit.asp?filename=tryajax_first
在http://www.w3schools.com/Ajax/tryit.asp?filename=tryajax_first查看实时示例
View the sample for getting xml data using ajax, http://www.w3schools.com/Ajax/ajax_xmlfile.asp
使用ajax查看获取xml数据的示例,http://www.w3schools.com/Ajax/ajax_xmlfile.asp
You can further read about ajax from here
您可以从这里进一步阅读有关ajax的信息