console.log prompts like this:
data: '{"site_name":"aaaa","site_keywords":"bbbb","site_beian":"闽ICP备8888888888号","site_description":"ccccc","site_statistic":"<a>wsdfadfasdfasdfasdfasdf</a>"}',
Obtaining json data from mysql, this problem occurs. How does the front end handle the conversion and parsing of the json type?
Convert String to JSON object :
Use JSON.stringify() to convert into a string for subsequent use.
Try to use JSON.parse, eval is not recommended;
Try to add try...catch, the probability of errors when converting JSON to objects is quite high, such as unescaped characters and too many nesting levels;
try{
} catch(e){
}
The backend sets the Content-Type of the response header to application/json, and the data outputs a string in json format. The frontend automatically obtains the JSON object, which can be processed as an ordinary js object.