Ajax return string filter implementation code _AJAX related

Source: Internet
Author: User
JS code is as follows.
After invoking the Ajax return. A strange question. The returned resultstring value is "OK" but is not equal to the string "OK" comparison.
What parameters are added to the AJAX call Out.println ()?
The part of releasing the annotation is not filtered out.
Which expert has encountered a similar problem.
How to solve.
Please say it. Out.println (): What is the return?
JS Code
Copy Code code as follows:

Local Downloads
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 Code code as follows:

callback function
function Gocallback () {
if (xmlhttp.readystate = = 4) {
if (Xmlhttp.status = = 200) {
Results of implementation
var resultstring = Xmlhttp.responsetext;
alert (resultstring);
var newstrb = resultstring. replace ("\ r", "123");
Let's comment it out first.
Alert ("newstrb-" + NEWSTRB + "-");
if ("OK" = = NEWSTRB) {
Alert ("Success");
Document.getelementsbyname ("Buttonsave") [0].disabled = "";
}else{
Alert ("<bean:message key=" Ftptest.info.fail "/>");
document.getElementById ("ErrorMessage"). InnerHTML = ' Test unsuccessful ';
Document.getelementsbyname ("Buttonsave") [0].disabled = "true";
}
}
}
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.