Quantcast
Channel: ThingSpeak IoT Community - All Forums
Viewing all articles
Browse latest Browse all 1833

turti on Read last value from ThingSpeak into my website

$
0
0

Hello,

I serched the last hole night to find a solution for my problem:

On my website I want to see the last temperature I´ve logged to ThingSpeak. If I type:

https://thingspeak.com/channels/mychannelID/field/1/last.html

in my browser, I got the last temperature.

So I take this link and put it in this code:

<html>
<head>
<title>Temperatur</title>
<script type="text/javascript">
function nachladen() {
var http = null;
if (window.XMLHttpRequest) {
http = new XMLHttpRequest();
} else if (window.ActiveXObject) {
http = new ActiveXObject("Microsoft.XMLHTTP");
}
if (http != null) {
http.open("GET", "http://thingspeak.com/channels/myChannelID/field/1/last.html", true);
http.onreadystatechange = ausgeben;
http.send(null);
}

function ausgeben() {
if (http.readyState == 4) {
document.getElementById("Ausgabe").innerHTML =
http.responseText;
}
}
}
window.onload=nachladen;
//--></script>
</head>
<body>
Temperatur:
<div id="Ausgabe"></div>
</body>
</html>

This does not work, because I think this is a link to an external site. If I change the link to an local "last.html" it works fine.

Has anyone a solution for me?

I did´nt want to have an iframeConfused

 

Thanks!


Viewing all articles
Browse latest Browse all 1833

Trending Articles