updateControls() changes the visual appearance of the web page controls. This function receives JSON input as the data parameter, which is in the form: {"level":50}. Starting on line (6) and using jQuery selectors, we update the slider control and text on the web page to reflect the new level value:
function updateControls(data) {
$("input[type=range].brightnessLevel").val(data.level); // (6)
$("#brightnessLevel").html(data.level);
}
Next, we'll see how we use JQuery to create an event handler that responds when we or another user changes to the web page's slider component.