Trying to send string "!S 00 01" to serial through http_request.open sends %20 instead of <space>
Webpage extract"width:100"type="button"value="ON/OFF"id="00"onClick="sendIR(id)"/>
<tr><input style=
New Function in main.js
/////////////////////////////
//
// send ir command
//
/////////////////////////////
function sendIR(id){
var http_request = open_ActiveXobject();
if(!http_request) return 0;
my_command = "serial="+"!S "+id+" 01";
//alert(my_command)
http_request.onreadystatechange = function() {;};
http_request.open('GET', 'tvcontrol.htm?'+my_command, true );
http_request.send(null);
}
Output
!S%2000%2001
Any ideas how to get round this?
Solved! Go to Solution.
I think you may be right. The GET method assumes it is dealing with a filename field so it does that windows thing of replacing spaces with %20. I thought there may be a way to turn off the parsing but not found it so far. I got round it by using a modified "form_serial_ function" with a few lines of code before the printf setting the %20's back to spaces,
Ah. Javascript...
"%20" is HTML's escape-character equivalent for representing a blank character. I am not sure that this feature can be disabled.
---Tom
I think you may be right. The GET method assumes it is dealing with a filename field so it does that windows thing of replacing spaces with %20. I thought there may be a way to turn off the parsing but not found it so far. I got round it by using a modified "form_serial_ function" with a few lines of code before the printf setting the %20's back to spaces,