In the Servers Book project 2.2 – Web Server – Control MultipleOutputs (Toggle Switches)
This line is used to send the update request when a slider is activated
xhr.open(“GET”, “/update?output=”+element.id+”&state=1”, true);
Why are the “+” signs requied to top and tail element.id?
Hi.
The plus signs are concatenating the request with the string that will be returned by “element.id”.
So, imagine the element.id returns “2”, the request would be on the following URL:
/update?output=2&state=1
I hope this is clear.
Regards,
Sara
Thanks for that Sara, I hadn’t realised that the XMLHttpRequest() parameter was one continuous string, but I should have done – guilty of overthinking it!