Hello,
I have a strange problem:
I upload a file to my server with FileTransfer and i want to process the response of the server on the client.
The response is this string: "{“error”:false,“new_name”:“596108fe2b63d7.14487709.jpg”}"
But when i run JSON.parse on this string i get an “SyntaxError: Unexpected token in JSON at position 0”.
If i run an external validation on this string, it is valid to be used as JSON
Ok, looks like the error was on my side:
When i copied all the data together, to post it here, i realised that the was a whitespace at the beginning of data.response, which was not visible in the chrome console but in my text editor.
So i just run trim() before parsing and everything works just fine
Thanks for helping.