servlet returns json string, ajax accept defeat


Background splicing out the servlet json string receiving reception Ajax, datatype to text / html smooth to take the string, but instead the datatype json Ajax response error
String json = "{";
json + = " 'the userName': 'Tiny', ";
JSON + =" 'userNo': '123'} ";
writer.Write (JSON);

after the output string to
string JSON =" { ";
JSON + =" \ "the userName \": \ "Tiny \", ";
JSON + =" \ "userNo \": \ "123 \"} ";
writer.Write (JSON);

the successful

Reproduced in: https: //my.oschina.net/silor/blog/222653

Guess you like

Origin blog.csdn.net/weixin_33827731/article/details/91703401