HTTP POST to a website using Javascript and Microsoft XMLHTTP<html>
<head>
<script type="text/javascript">
function HTTPPostButton_onclick()
{
var url = "...";
var method = "POST";
var dataToSend = "<Details>...</Details>";
var connect = new ActiveXObject("Microsoft.XMLHTTP");
connect.Open(method, url, false);
connect.setRequestHeader("Content-Type", "text/xml");
connect.send(dataToSend);
document.getElementById("result").innerHTML=connect.responseText;
}
</script>
</head>
<input type="button" value="Test" onclick="return HTTPPostButton_onclick()" />
<span id="result"></span>
</html>
No comments:
Post a Comment