HTA - json

hta,js,json

json cmd over http

<HTML>
<Meta charset = "UTF-. 8" />
<head>
<title> Call WebService Via Ajax </ title>
<Script>
var = new new XHR the XMLHttpRequest ();
function SENDMSG () {
var name = document.getElementById . ( 'name') value;
// address and services
var wsUrl = 'http://192.168.0.24:4888';
// request body
var param = '{ "command" : "API_start", "ver": " 1.1 "} ';
// open connection
xhr.open (' the POST ', wsUrl, to true);
// reset request header
xhr.setRequestHeader (" Content-Type ", " application / json; charset = UTF-8 ") ;
//xhr.setRequestHeader("SOAPAction "," http://WebXml.com.cn/getRegionCountry ");
// set the callback function
xhr.onreadystatechange = _back;
// send a request
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>

   

Guess you like

Origin www.cnblogs.com/reboost/p/9686090.html