AJAX 接受值

来源:百度知道 编辑:UC知道 时间:2024/06/30 02:00:40
请问
我用AJAX写了一个方法

然后在action返回个out.print("sdf");
请问在jsp中如何得到这个值
比如用var a = 某某();
然后我要用来做比较
if else
请高人指点

jsp
中是这样的写的

function textPost(){

if (window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}else if (window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}
xmlHttp.open("POST","${pageContext.request.contextPath}/getOaimf.do?suser=${loginuser.suser}&date="+new Date(),false);
xmlHttp.onreadystatechange = CallBack;
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlHttp.send();
}
function CallBack(){
if (xmlHttp.readyState == 4){
if (xmlHttp.status == 200){
---------------------------------------------
var text = xmlHttp.responseText;
document.getElementById("count").innerHTML = text;
---------------------------------------------------
}else{
document.getElementById("count").innerHTML = "服务端出错";
}

var mytime=setTimeout("textPost(