Send Data To Hardware And Go To Another Webpage?
My goal is to use a photon and by click on a button some data is sent to the photon via the cloud. However, at the same time I would like to go to another page as well. The problem
Solution 1:
onclick
should be onclick="myFunction1('setGame');myFunction2()"
like
<input id="Memory Button" type="button" value="Memory Game" onclick="myFunction1('setGame');myFunction2()"/>
total
<!DOCTYPE html>
<html>
<body>
<input id="Memory Button" type="button" value="Memory Game" onclick="myFunction1('setGame');myFunction2()"/>
<script language="javascript" type="text/javascript">
function myFunction1(objButton)
{
var deviceID = "1f0026001847353236343033";
var accessToken = "edc90d3d0f4048681a946f75a7bbe221ad7e1110";
var baseURL = "https://api.particle.io/v1/devices/";
varname=objButton;
requestURL= baseURL + deviceID + "/" + varName + "/?access_token=" + accessToken;
$.post( requestURL, { params: varName , access_token: accessToken });
}
function myFunction2()
{
window.location.href = 'http://twin-cities.umn.edu/';
}
</script>
</body>
</html>
Post a Comment for "Send Data To Hardware And Go To Another Webpage?"