Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

1 solution

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

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900