When posting a full url(https://www.example.com/) via JS to my flask app it runs smoothly, but as soon as I add a url path (https://www.example.com/test-test) I get the error below when trying to JSON.parse(response)
- Uncaught SyntaxError: Unexpected token < in JSON at position 0 at
When posting the url, I replace the forward slash’s with as per below so my @view accepts the url as a parameter and not a url at first.
url = url.replace(/\//g, '_|_');
and then I revert back to original url structure on the @view before the request.
url = url.replace("_|_", "/")
I’m guessing my problem is the “-” dash on the url path, but have tried the above solution with no success.