Hi after reading @bko 's nice tutorial on Reading spark vars ( Reading Spark Variables with Your Own HTML File ) I created a function to get variable data from particle. I keep getting Failed to load resource: the server responded with a status of 404 (Not Found) error on my console. can someone help me understand what is happening here?
I have checked the requestURL output and it looks exactly the same as URL i’m using in the “Control LEDs over the net” example. And YES, I am (globally) declaring “deviceID”, “varName”, and “accessToken” with the correct values for my particle board.
That’s a great idea. The browser console is usually the way I debug this type of problem.
@superliminal should also check the version of jquery: cut and past the script URL for the jquery library near the top of the file into a browser window and see if you get a bunch of text or 404.
@bko Yes I just discovered the console in my browser, great find. I entered the jquery URL into my browser and got a bunch of text, so i guess its finding it.
@rickkas7 I already tried removing the slash and I get the same result:(
Are you sure your variable name is correct?
If you want to make sure your setup is correct (other than that page), you can try requesting your variable here (and seeing if it shows up in the first place).
If you can’t see it in the browser by pasting that link, it’s not going to work in your javascript either.
Ok in order to redeem myself, I will at least post my code now that its all working.
This is very simple but I think useful demonstration of how to monitor and update particle values. All this app does is 1. check if an LED is currently powered on or off 2. update the switch (checkbox) and text on the webpage to the current state of the LED and 3. switch the LED on or off when the switch is pressed.