URL Form request  serial function

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

URL Form request  serial function

跳至解决方案
1,396 次查看
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?

标签 (1)
0 项奖励
回复
1 解答
1,211 次查看
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 项奖励
回复
2 回复数
1,211 次查看
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 项奖励
回复
1,212 次查看
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 项奖励
回复