conn:send('<input style="width:550px; height:50px" type="range" name="cmd" id="cmd" value="" min=1 max=1023 step=1 onchange="myFunction()"/>')
conn:send('<script>')
conn:send('function myFunction() {')
conn:send(' var x = document.getElementById("cmd").value;')
conn:send(' var uri = "\?somevar=" + x;')
conn:send(' var enc = encodeURI(uri);')
conn:send(' document.location.href=\enc;')
conn:send('}</script>')
And here is what I replaced it with. The href line is replaced with four xml lines:
conn:send('<script>')
conn:send('function myFunction() {')
conn:send(' var x = document.getElementById("cmd").value;')
conn:send(' document.getElementById("demo").innerHTML = x ;')
conn:send(' var uri = "\?somevar=" + x;')
conn:send(' var enc = encodeURI(uri);')
conn:send(' var xhttp = new XMLHttpRequest();')
conn:send(' xhttp.onreadystatechange = function() {')
conn:send(' if (xhttp.readyState == 4 && xhttp.status == 200) {')
conn:send(' }')
conn:send(' };')
conn:send(' xhttp.open("GET", uri, true);')
conn:send(' xhttp.send();')
conn:send(' }</script>')
I think there is some clean up that can be done. I tested my code in Firefox, Chrome, (both desktop and Android phone) as well as IE and IE refused to load the page so there's probably some format issue regarding that. Right now, I don't plan on using IE but would like to fix it anyway.