如何在HTML中显示Bash结果 [英] How do I Show a Bash Result in HTML

查看:185
本文介绍了如何在HTML中显示Bash结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我有一个项目,我必须在网站上显示当前的温度。

我已经创建了一个脚本在bash中回应我当前的温度,但我真的不知道如何在我的网站上显示该结果。



真诚,



Yvan MLS

解决方案

可能有其他方法可以做到这一点,但你可以考虑使用 XMLHttpRequest 对象如下例所示。



 xmlhttp =  new  XMLHttpRequest(); 
xmlhttp.open( GET temperaure.txt false );
xmlhttp.send();
document.getElementById( temperature)。innerHTML = xmlhttp.responseText;


Hello,

I have a project where I have to show the current temperature on a website.
I already created a script in bash that "echo" me the current temperature, but I don't really know how to display that result on my website.

Sincerly,

Yvan MLS

解决方案

There may be other ways of doing this, but you could consider using the XMLHttpRequest object as in the example below.

xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","temperaure.txt",false);
xmlhttp.send();
document.getElementById("temperature").innerHTML=xmlhttp.responseText;


这篇关于如何在HTML中显示Bash结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆