Hey there!
I’m developing an online store with JS, PHP and MySQL and I have this weird error when trying to parse a JSON string.
Uncaught SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at XMLHttpRequest.xhr.onreadystatechange (cart.js:24)
I know what you’re probably thinking but the weird part is that even when I’m getting this error, the string is being parsed and that’s because there’s nothing wrong with the syntax actually. This is an example of what I’m recieving from the json_encode PHP function:
{"amount":"3","target":"d32asd15as6d1","count":1}
Then as I said, the string gets parsed anyways and I have access to all the object’s properties as expected, but I can’t keep going because I can’t use forEach method with the parsed string. Any idea?
Thank you!