<!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="tstamp"></span><br>
Enter budget: <input type= "text" bu="b1"><br>
Enter start date: <input type= "text" bu="b2”><br>
<button id="connectbutton" onclick="start()">Enter </button>
<script type="text/javascript">
function start(objButton) {
document.getElementById("tstamp").innerHTML ="";
var deviceID = “350035001547343339383037”;
var accessToken = "703a5e03e8ee64e4864fec7616f0f01b1236c3a0";
var varName = "budget";
var varName = “date”;
requestURL = "https://api.spark.io/v1/devices/" + deviceID + "/" + varName + "/?access_token=" + accessToken;
$.getJSON(requestURL, function(json) {
document.getElementById("tstamp").innerHTML = json.coreInfo.last_heard;
document.getElementById("b1").value = parse(json.result);
document.getElementById("b2”).value = parse(json.result);
});
}
</script>
</body>
</html>
Click to Expand
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .