On 12/10/17 15:36, steve-ALUG@hst.me.uk wrote:
On 12/10/17 10:04, Simon Ransome wrote: [SNIP]
elsif url eq "/myajaxhandler": # get your LED state from URL params self.send_response(200) GPIO.setStuffHere()
So I guess to call this I'd just to a HTTP "Get" to a URL "http://The.IP.Address.xx/myajaxhandler?Some=Params,Here=etc"
And then decode the params & bob's my uncle?
Yes, exactly that. Your onChange or other event handler on the sliders responds to the slide event. You would then build a URL with the extra parameters containing the values of the various sliders, and use that as the basis for an XmlHTTPRequest (which is the Ajax bit). If you wanted to be a bit more cross-browser you could use an Ajax helper from jQuery or some other JavaScript library.
Your server then decodes it (urlparse can do that) and in theory your JavaScript doesn't even need to bother with handling the response, but you may want to add some sort of throttling (like waiting for any current requests to complete) if your sliders generate too many events.
There's a simple example of the Ajax call here: https://www.w3schools.com/xml/ajax_intro.asp
Simon