The JS Code is as follows.
After Ajax is called. A strange problem. The returned resultString value is "OK" but is not equal to the string "OK.
What parameters are added to the results returned by Ajax calling out. println?
The comments cannot be filtered out.
Which of the following experts has encountered similar problems.
How to solve the problem.
Let's talk about it. Out. println (); what is returned.
Js Code
Copy codeThe Code is as follows:
// Download locally
Function FTPTest (ip, port, username, password, filedir ){
Alert ("test ");
CreateXMLHttpRequest ();
Var url = "DataExportAjaxServlet. doajax? OsFlg = ftptest & ip = "+ ip +" & port = "+ port;
XmlHttp. open ("GET", url, true );
XmlHttp. onreadystatechange = goCallback;
XmlHttp. send (null );
}
Js Code
Copy codeThe Code is as follows:
// Callback function
Function goCallback (){
If (xmlHttp. readyState = 4 ){
If (xmlHttp. status = 200 ){
// Obtain the execution result
Var resultString = xmlHttp. responseText;
Alert (resultString );
// Var newstrb = resultString. replace ("\ r", "123 ");
// Comment out this sentence first
// Alert ("newstrb-" + newstrb + "-");
If ("OK" = newstrb ){
Alert ("successful ");
Document. getElementsByName ("buttonSave") [0]. disabled = "";
} Else {
Alert ("<bean: message key =" ftptest.info. fail "/> ");
Document. getElementById ("errorMessage"). innerHTML = 'test failed ';
Document. getElementsByName ("buttonSave") [0]. disabled = "true ";
}
}
}
}