SyntaxError: JSON.parse: Unexpected Character
I have a JSON parse error that I can't debug. Code below: $(document).on('submit', '#confirmreset', function(event) { event.preventDefault(); var action_url = $(this).attr
Solution 1:
You don't need to call $.parseJSON
if the server is sending valid JSON as jQuery will parse it automatically when it retrieves the response. I don't know the exact criteria, but if you set the Content-type: application/json
header it definitely will.
Solution 2:
This error can be caused by using single quotation marks ('
) instead of double ("
) for strings.
The JSON spec requires double quotation marks for strings.
See also:
Solution 3:
Only put these=>
dataType: 'text', // what to expect back from the PHP script, if anything cache: false, contentType: false, processData: false,
Post a Comment for "SyntaxError: JSON.parse: Unexpected Character"