var getXmlDoc_xmlHttp;
getXmlDoc_xmlHttp.open("GET", url, false);
getXmlDoc_xmlHttp.send();
var xmlobj = getXmlDoc_xmlHttp.responseXML;xmlobj是一个xml的document对象,这样你就可以用document的的方法遍历这个对象,得到你的的结果啦.
getXmlDoc_xmlHttp.open("GET", url, false);
getXmlDoc_xmlHttp.send();
var xmlobj = getXmlDoc_xmlHttp.responseXML;xmlobj是一个xml的document对象,这样你就可以用document的的方法遍历这个对象,得到你的的结果啦.
var actionName="controller";
/*at client get server url */
var arrStr = window.location.href.split('/');
/**
arrStr="http://localhost:8080/MetaIndexer/";
arrStr[0]="http:";
arrStr[1]="";
arrStr[2]="localhost:8080";
arrStr[3]="MetaIndexer";
*/
var strServer =arrStr[0]+"//"+arrStr[2]+"/"+arrStr[3]+"/";
//------------------------------------------------------------------------------//
//------------------------------------------------------------------------------//
//Function: send a message for getting text of http,using global variable 'strServer', 'actionName'
//Author: Hellin
//Date: Apr. first, 2005
//Develop Tool: Jbuilder 9 EN
//------------------------------------------------------------------------------//
function sendHTMLMessage(Event,params,xmlString){
var xmlhttp;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
} catch (e) {
try {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
} catch (E) {
xmlhttp=false
}
}
@else
xmlhttp=false
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp=false;
}
}
//Prepare to request the server
var strURL=strServer+actionName;
var url=strURL+"/"+Event+params;
//xmlhttp.open("GET", "code.html",true);
//alert("url: "+url);
xmlhttp.open("POST", url, false);
xmlhttp.send(xmlString);
var strHtml=xmlhttp.responseText;
//alert("strHtml: "+strHtml);
if(strHtml!=null&& strHtml!=''){
if(strHtml.indexOf("MessageException:")>-1){
var no=strHtml.indexOf(":")+1;
alert(strHtml.substring(no));
return false;
}
}else{
alert("No response from the server, return null.");
return false;
}
return strHtml;
}
//Function: send a message for getting a xmldom obj,using global variable 'strServer', 'actionName'
//Author: Hellin
//Date: Apr. first, 2005
//Develop Tool: Jbuilder 9 EN
//------------------------------------------------------------------------------//
function sendXMLMessage(Event,params,xmlString){
var xmlDoc;
try{
var strURL=strServer+actionName;
var url=strURL+"/"+Event+params;
try{
xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
}catch(e){
try{
xmlDoc = document.implementation.createDocument("","",null);
}catch(e){
alert("Error occur: sendXMLMessage, Failed!");
return false;
}
}
xmlDoc.async = false;
xmlDoc.resolveExternals = false;
//alert("url: "+url);
xmlDoc.load(url);
}catch(e){
alert("Error occur: sendXMLMessage, Failed!");
return false;
}
return xmlDoc;
}
function getXMLMessage(params){
var xmlDoc;
var ua = navigator.userAgent.toLowerCase();
if(ua.indexOf('safari') == - 1){
try{
var url=strServer+params;//strServer="http://localhost:8080/MetaIndexer/";
try{
xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
}catch(e){
try{
xmlDoc = document.implementation.createDocument("","",null);
}catch(e){
alert("Error occur: sendXMLMessage, Failed!");
return false;
}
}
xmlDoc.async = false;
xmlDoc.resolveExternals = false;
//alert("url: "+url);
xmlDoc.load(url);
/*if (xmlDoc.documentElement.nodeName=="wcexception"){
alert(xmlDoc.documentElement.text);
return false;
}*/
}catch(e){
alert("Error occur: sendXMLMessage, Failed!");
return false;
}
}else{
xmlDoc = importXML( url, 'runThis', false, 2000 );
}
return xmlDoc;
}