var xmlhttp;
function showData(){
var type = "show";
try{
xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
}catch(e){
try{
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}catch(e){
try{
xmlhttp = new XMLHttpRequest();
}catch(e){}
}
}
xmlhttp.onreadystatechange=function(){
if (4==xmlhttp.readyState){
if (200==xmlhttp.status){
var data;
alert('ok'); //这句都执行了,证明ajax没有问题
alert(JSON.parse(xmlHttp.responseText));//这出出了问题,
// 提示 Line:105
// Char:13
// Code:0
// Error:例外被抛出且未被接住
//我的json.js 已导入了。这是怎么回事啊。 }else{
alert("error");
}
}
}
xmlhttp.open("post", "pool");
xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
xmlhttp.send("type="+type);
}
还有一个问题,我在servlet中遍历数据库,并通过jsonObj.put("",""));存入json对象中了,可怎么才能全部传回来啊。
我用out.println(jsonObj.toString());可只是传回来最后一条记录。。??
希望高手们帮忙吧。1
function showData(){
var type = "show";
try{
xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
}catch(e){
try{
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}catch(e){
try{
xmlhttp = new XMLHttpRequest();
}catch(e){}
}
}
xmlhttp.onreadystatechange=function(){
if (4==xmlhttp.readyState){
if (200==xmlhttp.status){
var data;
alert('ok'); //这句都执行了,证明ajax没有问题
alert(JSON.parse(xmlHttp.responseText));//这出出了问题,
// 提示 Line:105
// Char:13
// Code:0
// Error:例外被抛出且未被接住
//我的json.js 已导入了。这是怎么回事啊。 }else{
alert("error");
}
}
}
xmlhttp.open("post", "pool");
xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
xmlhttp.send("type="+type);
}
还有一个问题,我在servlet中遍历数据库,并通过jsonObj.put("",""));存入json对象中了,可怎么才能全部传回来啊。
我用out.println(jsonObj.toString());可只是传回来最后一条记录。。??
希望高手们帮忙吧。1
楼主【xiaoxiao8372】截止到2008-07-19 21:31:17的历史汇总数据(不包括此帖):
发帖的总数量:43 发帖的总分数:518 每贴平均分数:12
回帖的总数量:63 得分贴总数量:17 回帖的得分率:26%
结贴的总数量:37 结贴的总分数:498
无满意结贴数:3 无满意结贴分:26
未结的帖子数:6 未结的总分数:20
结贴的百分比:86.05 % 结分的百分比:96.14 %
无满意结贴率:8.11 % 无满意结分率:5.22 %
楼主加油