URL Form request  serial function

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

URL Form request  serial function

Jump to solution
817 Views
seagate
Contributor III

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?

Labels (1)
0 Kudos
Reply
1 Solution
632 Views
seagate
Contributor III

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,

View solution in original post

0 Kudos
Reply
2 Replies
632 Views
J2MEJediMaster
Specialist I

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

0 Kudos
Reply
633 Views
seagate
Contributor III

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,

0 Kudos
Reply