var xmlhttp ;
function getdatafromsc(url,senddata){
//AJAX后台取数据
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
if(!xmlhttp){
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
//设置回调函数
xmlhttp.onreadystatechange=backlog;
///
xmlhttp.Open("POST",url, false);
//xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-Type", "application/json");
///xmlhttp.setRequestHeader("setTimeOut","200000");
//xmlhttp.Send("{jianpfl:"+jianpfl+",ids:"+ids+"}");
xmlhttp.Send(senddata);
//TransformCgi(
//返回值接收
//var returnDOM = xmlhttp.responseXML;
//document.getElementById("result").innerHTML = xmlhttp.responseText
//alert("XML数据 原始文本内容为:" + xmlhttp.responseText);
//alert( xmlhttp.responseText);
//$("#resultjson").contents().find("body").html( xmlhttp.responseText);
}
function backlog(){
if(xmlhttp.readystate==4){
if(xmlhttp.status==200){
//$("#resultjson").contents().find("body").html( xmlhttp.responseText);
// $("#resultjson").contents().find("body").html("<iframe >"+xmlhttp.responseText+"</iframe>");
// alert( xmlhttp.responseXML);
var restxt=xmlhttp.responseText;
var jsontxt=restxt.substring(restxt.indexOf("{"),restxt.lastIndexOf("}")+1);
var resjson= eval("("+jsontxt+")");
// alert(resjson.data);
document.getElementById("result").innerHTML=resjson.data;
window.opener.location.reload();
this.close();
}
}
}
// 刷新父页面
------#-------
PrintWriter pw = getAgentOutput();
pw.println("<script>");
pw.println("window.opener.location.reload(); ");
pw.println("window.close();");
pw.println("</script>");
--------或者 -------------
PrintWriter pw = getAgentOutput();
pw.println("content-type:text/plain;charset=utf-8");
pw.println("content-type:application/json;charset=UTF-8");
if(errbh.equals("")){
pw.println("{\"status\":\"ok\",\"data\":\"操作成功!\"}");
}else{
pw.println("{\"status\":\"ok\",\"data\":\"操作失败!\}");
}
pw.println();
pw.flush();
pw.close();