calling GetResponse multiple times not working?
skynugget
Posts: 172
so i amended Mike G.'s restful led demo html code to show/control pins 23-27.
all works as expected except for one thing.
i added multiple calls to GetResponse for each led, thinking it would turn on all of the led's it does not. it only turns on led23. if i comment out the first GetResponse it turns on led24, and so on.
it seemed like it was doing the first GetResponse then bailing on the script, but then i added an alert box for each step, and i get all 5 alert windows, so i am now lost!
does anyone see a problem with what im trying?
thanks!
all works as expected except for one thing.
i added multiple calls to GetResponse for each led, thinking it would turn on all of the led's it does not. it only turns on led23. if i comment out the first GetResponse it turns on led24, and so on.
it seemed like it was doing the first GetResponse then bailing on the script, but then i added an alert box for each step, and i get all 5 alert windows, so i am now lost!
does anyone see a problem with what im trying?
thanks!
<body> <div id="content"> <h1><span id="time">Testing...</span></h1> <h2>PIN 23: <span id="pin23">State</span></h2> <p> <a href="#" onClick="return getRequest('led/23/on', 'pin23');">LED On</a> :: <a href="#" onClick="return getRequest('led/23/off', 'pin23');">LED Off</a> </p> <h2>PIN 24: <span id="pin24">State</span></h2> <p> <a href="#" onClick="return getRequest('led/24/on', 'pin24');">LED On</a> :: <a href="#" onClick="return getRequest('led/24/off', 'pin24');">LED Off</a> </p> <h2>PIN 25: <span id="pin25">State</span></h2> <p> <a href="#" onClick="return getRequest('led/25/on', 'pin25');">LED On</a> :: <a href="#" onClick="return getRequest('led/25/off', 'pin25');">LED Off</a> </p> <h2>PIN 26: <span id="pin26">State</span></h2> <p> <a href="#" onClick="return getRequest('led/26/on', 'pin26');">LED On</a> :: <a href="#" onClick="return getRequest('led/26/off', 'pin26');">LED Off</a> </p> <h2>PIN 27: <span id="pin27">State</span></h2> <p> <a href="#" onClick="return getRequest('led/27/on', 'pin27');">LED On</a> :: <a href="#" onClick="return getRequest('led/27/off', 'pin27');">LED Off</a> </p> </div> <script language="javascript" type="text/javascript"> alert("check pin23 now"); getRequest('led/23/on', 'pin23'); alert("check pin24 now"); getRequest('led/24/on', 'pin24'); alert("check pin25 now"); getRequest('led/25/on', 'pin25'); alert("check pin26 now"); getRequest('led/26/on', 'pin26'); alert("check pin27 now"); getRequest('led/27/on', 'pin27'); </script> </body>
Comments
i been keeping pase with the repository, and have the latest stringmethods already.
Better yet, why not send one command like led/all/on and handle the logic in server side SPIN?