Skip to content

Instantly share code, notes, and snippets.

@dansku
Created August 12, 2018 19:12
Show Gist options
  • Save dansku/a4d2c1261ee83a076341a37c0a9ca33f to your computer and use it in GitHub Desktop.
Save dansku/a4d2c1261ee83a076341a37c0a9ca33f to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript" charset="utf-8">
</script>
</head>
<body>
<div class="col-md-4 text-center" style="margin-top: 40px;">
<button id="openDoor" type="button" class="btn btn-primary btn-group-lg" onclick="openDoor()">Open Door
</button>
</div>
<script type="text/javascript">
var deviceID = "";
var accessToken = "";
var setFunc = 'open';
function openDoor() {
var requestURL = "https://api.spark.io/v1/devices/" +deviceID + "/" + setFunc + "/";
$.post( requestURL, {
access_token: accessToken }
);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment