Javascript-jQuery ajax () has several line breaks while solving the problem.

Source: Internet
Author: User
Use $. ajax () obtains the string from the backend php. Only loginSuccess or loginFaild characters are returned, and alert () and console are used. log () check is not wrong, but with firebug debugging, we can see that the return value character is followed by several rnrn characters, resulting in js judgment failure, such...

Use $. ajax () obtains the string from the backend php. Only loginSuccess or loginFaild characters are returned, and alert () and console are used. there is no error in log () check, but it can be seen through firebug debugging that the return value character is followed by several rnrn characters, leading to js judgment failure,

I searched the internet and some people encountered a similar situation. I tried jquery1.8 and 1.3 libraries, and these linefeeds will be added. I don't know if this is a jquery bug, or why?

Http://www.cnblogs.com/js-html/p/3384940.html

Reply content:

Use $. ajax () obtains the string from the backend php. Only loginSuccess or loginFaild characters are returned, and alert () and console are used. there is no error in log () check, but it can be seen through firebug debugging that the return value character is followed by several rnrn characters, leading to js judgment failure,

I searched the internet and some people encountered a similar situation. I tried jquery1.8 and 1.3 libraries, and these linefeeds will be added. I don't know if this is a jquery bug, or why?

Http://www.cnblogs.com/js-html/p/3384940.html

Check the php tag for any extra white space characters

Http://stackoverflow.com/questions/11593326/unwanted-new-line-returned-after-ajax-request

If such a character is received from the server, it should be because the server does not properly process the character to see if the corresponding php processing is too many characters.

The server returns the wrong data. I guess it is because?>The Terminator breaks several carriage return lines to make the php code and html look nice. However, after the json string is output, the html line feed after the php end is output, we recommend that you do not end the Code if it is a pure php code!

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.