这是ajax
var te= prompt("请输入值","");
main("22","query.do?value="+te);
alert(te);
//return val;//返回结果
}
function main(str1,str2)
{
id=document.getElementById(str1);
//alert(id);
url=str2;
view();
}
function view(){
createXMLHttpRequest();
xmlHttpRequest.open("post",url,true);
xmlHttpRequest.onreadystatechange = callback;
xmlHttpRequest.send(null);
return false;
}
function createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}else{
xmlHttpRequest = new XMLHttpRequest();
}
}
function callback(){
if(xmlHttpRequest.readyState == 4){
if(xmlHttpRequest.status == 200){
id.innerHTML = xmlHttpRequest.responseText;
}
}
}
action:
PrintWriter out=response.getWriter();
String s = request.getParameter("value");
out.print(s);
现在的情况是action已经接收到值了可就是没办法在页面上显示,需要怎么样才能在页面中显示 请各位高手尽量详细点 谢谢了!!!