eval () analytic function (JSON feedback value) function string parsing error problem in Ajax

Source: Internet
Author: User

eval () analytic function (JSON feedback value) function string parsing error problem in Ajax
In an Ajax effect implementation, Firefox error, the content meaning is probably "function string parsing error", so with alert (), found

var result = eval (xmlhttp.responsetext);

This eval function is an error. Xmlhttp.responsetext can pop normally, but as long as the Eval function is parsed, an error is reported and no data is displayed; I had to start setting breakpoints in a general handler, querying for errors, and I didn't know why. I initially locked the problem on the feedback value, but found that the JSON format of the string did not ask Problem ~, the content is OK, although saw a few <br/>, but did not care (say again, which company's qualified editors will be in the title to enter??) As a programmer I understand some of the basic operational requirements and common sense of editors, it is a great honor for me to encounter such an editorial group in such a large company. )
So tangled I, in Baidu query eval related functions, found that the Eval function in parsing, can not be in the string contains "R" "N" "<br/>" line break, so in the general processing program returned, I have a string for the replacement character processing

result = result. Replace ("n", ""). Replace ("R", ""). Replace ("<br/>", "");

The final question has been solved ~
Summary: The problem is not big, but you can see some unpleasant place, first of all, to say their own problems, as a program, Ming know the output is title type of data, it should be the corresponding processing of strings

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.