时间:2021-07-01 10:21:17 帮助过:38人阅读
// 本地下载
function FTPTest(ip, port, username, password, filedir){
alert("测试");
createXMLHttpRequest();
var url = "DataExportAjaxServlet.doajax?osFlg=ftptest&ip=" + ip + "&port=" + port;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange = goCallback;
xmlHttp.send(null);
}
Js代码
代码如下:
// 回调函数
function goCallback(){
if (xmlHttp.readyState == 4){
if (xmlHttp.status == 200){
// 取得执行的结果
var resultString = xmlHttp.responseText;
alert(resultString);
//var newstrb = resultString .replace("\r", "123");
//这句先注释掉
//alert("newstrb-" + newstrb + "-");
if ("ok" == newstrb ){
alert("成功");
document.getElementsByName("buttonSave")[0].disabled = "";
}else{
alert("<bean:message key="ftptest.info.fail"/>");
document.getElementById("errorMessage").innerHTML = '测试不成功';
document.getElementsByName("buttonSave")[0].disabled = "true";
}
}
}
}