@roinujo1 i reposted your question here with the sensitive credentials removed.
I am trying to use a photon that listens to a cloud variable “setGame” and does what it needs to accordingly. 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 doesn’t even go to the other page (the webpage is just a test page i am trying). It seems to be the json function that is causing it as it works when I comment it out. Is there a specific reason as to why its not working and if so is their a solution? I’m pretty sure I am using the .postjson incorrectly, but my logic is that it should work regardless if the data was sent correctly. Sorry if this is in the wrong place, but i’m desperate.
Do you have a Particle.variable() or a Particle.function() in your firmware? You are doing a POST which is for functions. If you have a variable, you should do a GET request.
I can't see where in your Javascript that you pass the String parameter to your Particle.function(). I think the Cloud is rejecting your function POST since you are not passing the correct arguments.
I have tried looking at your code multiple times but I cant follow nor understand it.
I just dont understnad how to send data and go to another webpage. I have a
Particle.function(setGame)
In my photon code. I dont understand how to program it using javascript without getting completely lost. Im sorry, thanks for the help. I will see what I can do.
I am not sure why that is not working for you. I would fire up the debugging console in the browser and see if there is an error being thrown in your Javascript code. I seem to recall that you might need to remove the trailing “/” on the requestURL now.
If your Javascript seems to be working, then you could try adding some Serial printf’s to the firmware to see if that part is working (I don’t see anything obvious there now).