+ 1
Using fetch api to query a db
I'm using fetch to query my db, it works fine when input a word or letter with only one row in the db table but when I it's more than 1 it returns "unexpected string in json at position 8", please why is it doing this. This is my html and js code: https://code.sololearn.com/WN0T41eaOXFJ/?ref=app
1 Antwort
+ 1
The most obvious problem is that your HTTP request is going to:
https://code.sololearn.com/WN0T41eaOXFJ/searchTest.php
You can't host a serverside API in sololearn. The best you can do is host elsewhere and return a CORS header that allows it to work from sololearn's domains. This is how you'll fix the problem.