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