I can’t seem to find the code to read your token and ID from a PHP file so it doesn’t get revealed in code.
I plan to use the tutorial HTML Get Variable:
<!DOCTYPE HTML>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<body>
<span id="temp">Waiting for data...</span><br>
<span id="tstamp"></span><br>
<script type="text/javascript">
window.setInterval(function() {
var deviceID = "<< device id >>";
var accessToken = "<< access token >>";
var varName = "temperature";
requestURL = "https://api.spark.io/v1/devices/" + deviceID + "/" + varName + "/?access_token=" + accessToken;
$.getJSON(requestURL, function(json) {
document.getElementById("temp").innerHTML = json.result + "° F";
document.getElementById("temp").style.fontSize = "28px";
document.getElementById("tstamp").innerHTML = json.coreInfo.last_heard;
});
}, 10000);
</script>
</body>
</html>