Home > Web Front-end > JS Tutorial > body text

Solution to pareseerror error in JQuery 1.3.2 or above_jquery

WBOY
Release: 2016-05-16 18:12:22
Original
1095 people have browsed it

It feels very strange. It was fine a while ago, but why is it suddenly reporting an error now? The program didn't move at all. So I started tracking and analyzing the content requested and returned. . . The final judgment is that jquery

does not recognize that the returned content is in json format. The content returned at that time was:

Copy code The code is as follows:

{'keylist':[
{'tid':'13',"sumnum':'1'},{'tid':'21','sumnum':'1'}
]}

After careful inspection, no problem was found. The characters of the return stream have been set to utf-8, and the content was detected with ff. ff can also recognize it as json format, but at this time, a "pareseerror" error was still reported. >Looking at the code, I suddenly discovered that the currently returned content is enclosed in English single quotes. I vaguely remembered that the strictest way of writing should be English double quotes, so I immediately modified the system's underlying library (c#)

’s json data generation method, all changed to English double quotes, the content returned after the change is as follows:


{"keylist":[
{"tid":"13","sumnum":"1"},{"tid":"21","sumnum": "1"}
]}


The result was put into the test server and the problem was solved! I really&*^#%@$@

Summary: Think about it carefully. A few days ago, the latest version of jquery was used to replace the old version in the group purchase system for some reasons. I did not expect this situation at the time. Later, I found information from the Internet and found that jquery has adopted stricter parsing of json since version 1.3.x. method, so the data must be written consistent with international standards.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!