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 is that when I try to press the button, it doesnt even go to the other page. Im not sure yet if the data is even being sent (haven't tested), but it should go to another page. Any help is much appreciated.
<!DOCTYPE html>
<html>
<body>
<input id="Memory Button" type="button" value="Memory Game" onclick="return 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>
See Question&Answers more detail:os