首页 > Web开发 > 详细

HTA - json

时间:2019-08-17 12:43:21      阅读:93      评论:0      收藏:0      [点我收藏+]

hta,js,json

json cmd over http

<html>
<meta charset="utf-8" />
<head>
<title>Call webservice via ajax</title>
<script>
var xhr = new XMLHttpRequest();
function sendMsg() {
var name = document.getElementById(‘name‘).value;
//服务的地址
var wsUrl = ‘http://192.168.0.24:4888‘;
//请求体
var param = ‘{"command":"API_start","ver":"1.1"}‘;
//打开连接
xhr.open(‘POST‘, wsUrl, true);
//重新设置请求头
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
//xhr.setRequestHeader("SOAPAction", "http://WebXml.com.cn/getRegionCountry");
//设置回调函数
xhr.onreadystatechange = _back;
//发送请求
xhr.send(param);
}
function _back() {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
document.getElementById(‘showInfo‘).innerHTML = xhr.responseText;
}
}
}
function sendMsg2() {
}
</script>
</head>
<body>
<input type="button" value="send command" onclick="sendMsg();">
<input type="text" id="name"><br />
<div id="showInfo">
</div>
</body>
</html>

   

HTA - json

原文:https://www.cnblogs.com/reboost/p/9686090.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!