I\'m successfully saving my data into a json file with a php script (save-data.php) but I\'m unable to fetch it correctly with my get-data.php script.
Er
Invariably, 99.9999999% of the time you get Unexpected token < in JSON as position 0
in the error, you did NOT receive json from the server. You received an HTML error message with your json following afterwards.
PHP warning: blah blah blah
{"foo":"bar"}
The leading ...<
in the
is where the error comes from, because that's position 0 (first character).
Check the raw data coming back from the server, and fix whatever the error/warning that PHP is spitting out.