Today, when I was writing the lab's stupid Java Web Gadget, there was a place to post content because what you wanted to do was make the user feel elegant.
So is the use of Ajax to do, originally very simple a small thing, unexpectedly spent more than half an hour of time, mainly to spend time in jquery can not return the JSON
The message data to the popup window display, this he is really enough to toss, originally thought is the back end of the setcontenttype problem, but the view on-line information is said to be
Use Application/json;charset=utf-8, this is the most standard, then why I set this is not possible, because I directly return is
The string in Java, which is directly spliced like "{' name ': ' Zjam ', ' age ': 20"} Such a string, so that caused the problem,
After searching to know that jquery more than 1.4 of the format of the JSON more stringent requirements, all the keys and attributes are marked with double quotes,
Otherwise it will be treated as a return string. What a pain, instead of "{\" name\ ": \" Zjam\ "}" after the format of the problem successfully resolved,
Really enough egg pain, it seems that in the future do not directly spell string, or use the library to solve the good.
Javaweb returning JSON-formatted data jquery ajax unresolved issues