[Solved] SyntaxError:JSON.parse:unexpected character at line 1 column 1 of the JSON data

Controller code:

Front end Ajax request code:

The status code 200 indicates that the request is successful, but the pop-up window (data returned by the server) cannot be received

Question tips:

SyntaxError:JSON. parse:unexpected character at line 1 column 1 of the JSON data

It is speculated that there was an error in parsing JSON data. The server wanted to use the string as JSON, but the format conversion failed

The reason is that I set the datatype in the Ajax request to “JSON”. JQuery will convert the string in the resp to JSON format according to this, but the conversion fails. Just comment out this line.

Read More: