Using $.ajax () Back-end PHP to get the string, there is only loginsuccess or loginfaild to return a few characters, using alert () and Console.log () to see there is nothing wrong, but with Firebug debugging see, The return value character is appended with a few rnrn characters, which causes the JS judgment to fail.
To search the Internet, but also someone encountered a similar situation, I tried the jquery1.8 and 1.3 of the library, will be more out of these newline characters, do not know this is a jquery bug, or what reason?
Http://www.cnblogs.com/js-html/p/3384940.html
Reply content:
Using $.ajax () Back-end PHP to get the string, there is only loginsuccess or loginfaild to return a few characters, using alert () and Console.log () to see there is nothing wrong, but with Firebug debugging see, The return value character is appended with a few rnrn characters, which causes the JS judgment to fail.
To search the Internet, but also someone encountered a similar situation, I tried the jquery1.8 and 1.3 of the library, will be more out of these newline characters, do not know this is a jquery bug, or what reason?
Http://www.cnblogs.com/js-html/p/3384940.html
Check for extra white space characters outside of PHP tags
Http://stackoverflow.com/questions/11593326/unwanted-new-line-returned-after-ajax-request
If you receive from the server to have such a character, which should be the service side is not good character processing, to see if the corresponding PHP processing is not a lot of characters
The service side returned the wrong data, guess is because the ?> end of the line to knock a few carriage returns to make the PHP code and HTML empty a few lines look good, but after the output of the JSON string after the end of the output of PHP HTML wrapping, it is recommended that if the pure PHP code should not write the Terminator!