<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<script type="text/javascript" src="xmlhttp.js"></script>
<!--引入出啊概念了XMLHttpRequest对象的js文件--><script type="text/javascript">
var xmlhttp;
var opp;
function go(){
// opp=op;
//e_obj=document.getElementById(value);
xmlhttp=createXMLHttpRequest();//调用创建XMLHttpRequest对象的方法
//alert(xmlhttp);
xmlhttp.onreadystatechange=callback;//设置回调函数
xmlhttp.open("post","index.jsp");//向服务器端发送请求 //请求servlet失败
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
xmlhttp.send(null);//设置发送参数
}
function addRow(align,n1,n2){
var tt=document.getElementById('userinfo');
var newRow=tt.insertRow();
for(var c=1;c<3;c++){
var newCell=newRow.insertCell();
newCell.align=align;
newCell.innerHTML=eval("n"+c);
}
}
function callback(){
//alert('callback');
if(xmlhttp.readyState==4){
if(xmlhttp.status==200){
var jsonObj=new Object();
// alert(xmlhttp.responseText);
jsonObj=xmlhttp.responseText;
alert(jsonObj);
for(var t=0;t<jsonObj.Userinfo.length;t++){
//addRow("center",jsonObj.Userinfo[t].name,jsonObj.Userinfo[t].pwd);
}
}
}
}
</script>
</head>
<body background="bg.gif" onload="go()">
</body>
</html>怎样让它显示表格?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<script type="text/javascript" src="xmlhttp.js"></script>
<!--引入出啊概念了XMLHttpRequest对象的js文件--><script type="text/javascript">
var xmlhttp;
var opp;
function go(){
// opp=op;
//e_obj=document.getElementById(value);
xmlhttp=createXMLHttpRequest();//调用创建XMLHttpRequest对象的方法
//alert(xmlhttp);
xmlhttp.onreadystatechange=callback;//设置回调函数
xmlhttp.open("post","index.jsp");//向服务器端发送请求 //请求servlet失败
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
xmlhttp.send(null);//设置发送参数
}
function addRow(align,n1,n2){
var tt=document.getElementById('userinfo');
var newRow=tt.insertRow();
for(var c=1;c<3;c++){
var newCell=newRow.insertCell();
newCell.align=align;
newCell.innerHTML=eval("n"+c);
}
}
function callback(){
//alert('callback');
if(xmlhttp.readyState==4){
if(xmlhttp.status==200){
var jsonObj=new Object();
// alert(xmlhttp.responseText);
jsonObj=xmlhttp.responseText;
alert(jsonObj);
for(var t=0;t<jsonObj.Userinfo.length;t++){
//addRow("center",jsonObj.Userinfo[t].name,jsonObj.Userinfo[t].pwd);
}
}
}
}
</script>
</head>
<body background="bg.gif" onload="go()">
</body>
</html>怎样让它显示表格?
http://topic.csdn.net/u/20070713/16/aae03828-bab1-47e9-b0dd-922618666a6b.html