@moors7: Moved some posts from another post to here, since that makes more sense and is ultimately less confusing
I’m actually having the same issue…getting 404 not found error. My variables are:
getRelay1 (string)
getRelay2 (string)
getRelay3 (string)
getRelay4 (string)
I’m trying to get my relay variables in a larger html page, but in order to get a better understanding of reading the variables I’m starting with an individual page for now. So my bigger html file uses the latest Particle API javascript. I notice this example uses jquery, is it possible to load both in one html file, or is jquery included in the recent javascript?
In the mean time, staying relative to this example, here is the html/javascript I’m using and I’m getting error 404 Not Found. I don’t have a publish event, but from what I gather, the purpose of this tutorial is you don’t need a publish event, is that correct?
<!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="setup"></span><br>
<button id="connectbutton" onclick="start()">Get Setup</button>
<script type="text/javascript">
function start(objButton) {
document.getElementById("setup").innerHTML = "Waiting for data...";
var deviceID = "35002400094734343231xxxx";
var accessToken = "3aaacdf9121d404c1a60d5f5f853585c156axxxx";
var varName = "getRelay1";
requestURL = "https://api.particle.io/v1/devices" + deviceID + "/" + varName + "/?access_token=" + accessToken;
$.getJSON(requestURL, function(json) {
document.getElementById("setup").innerHTML = json.result;
});
}
</script>
</body>
</html>