<div id="divDisplay">The response will be put in here</div>
<input type="button" onclick="sendData();" value="Send it!">
<script>
function sendData(){
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("POST", "http://www.yoursite.com/thispage.asp", false);
xmlhttp.Send("<timesheet>An impossibly useless timesheet fragment</timesheet>");
divDisplay.innerHTML=xmlhttp.responseText;
}
</script>
<input type="button" onclick="sendData();" value="Send it!">
<script>
function sendData(){
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("POST", "http://www.yoursite.com/thispage.asp", false);
xmlhttp.Send("<timesheet>An impossibly useless timesheet fragment</timesheet>");
divDisplay.innerHTML=xmlhttp.responseText;
}
</script>
<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<meta http-equiv="pragma" content="no-cache">
</head>
<body>
<%
if(request.getParameter("testc")!=null){
try{
javax.servlet.ServletInputStream in = request.getInputStream();
int c = in.read();
byte []b=new byte[1000];
int len = 0;
while(c!=-1){
b[len] = (byte)c;
len++;
c = in.read();
}
String str = new String(b,0,len);
str=new String(str.getBytes("GBK"),"UTF-8");
out.println(str);
}catch(Exception e){
out.println(e.getMessage());
}
}
%><div id="divDisplay">The response will be put in here</div>
<input type="button" onclick="sendData();" value="Send it!">
<script>
function sendData(){
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("POST", "t.jsp?testc=23;34;", false);
xmlhttp.Send("中文");
alert(xmlhttp.responseText);
}
</script>
</body>
</html>