我用的是prototype,程序在执行成功以后.返回空值.不成功返回提示在JS部分中......
if (trans.responseText) {
alert(trans.responseText);
} else {
alert(trans.responseText);
}
.........trans.responseText成功的话返回:<?xml version="1.0" encoding="utf-8"?><string xmlns="http://tempuri.org"/>不成功返回:<?xml version="1.0" encoding="utf-8"?><string xmlns="http://tempuri.org">更新失败,该分类名已经存在!</string>
我用下面的函数过滤
function TransXml(responseXML) {
try {
return responseXML.childNodes[0].textContent || responseXML.childNodes(1).text;
} catch (e) {
return '';
}
}结果却是不管成功与否...都弹出 空..这个过滤哪里写错了吗?请求帮助!
if (trans.responseText) {
alert(trans.responseText);
} else {
alert(trans.responseText);
}
.........trans.responseText成功的话返回:<?xml version="1.0" encoding="utf-8"?><string xmlns="http://tempuri.org"/>不成功返回:<?xml version="1.0" encoding="utf-8"?><string xmlns="http://tempuri.org">更新失败,该分类名已经存在!</string>
我用下面的函数过滤
function TransXml(responseXML) {
try {
return responseXML.childNodes[0].textContent || responseXML.childNodes(1).text;
} catch (e) {
return '';
}
}结果却是不管成功与否...都弹出 空..这个过滤哪里写错了吗?请求帮助!
try {
return responseXML.childNodes[0].textContent || responseXML.childNodes(1).innerHTML;
} catch (e) {
return '';
}
}
function editofferclass()
{
var xx='<?xml version="1.0" encoding="utf-8"?><string xmlns="http://tempuri.org"/>更新失败,该分类名已经存在!';
alert(TransXml(xx));
}
我直接这样测试了一下.还是返回空值呢..弹出空值这怎么回事?