44
rated 0 times
[
48]
[
4]
/ answers: 1 / hits: 27667
/ 9 Years ago, wed, may 6, 2015, 12:00:00
I am using FETCH API to get a value stored in a json file. That value has to go into a variable.
The problem is - the variable ends up holding [object Object] as value.
var title = fetch('URL/out.json', {mode: 'cors'});
In the htaccess of the server hosting the json file, there is the line
Header set Access-Control-Allow-Origin *
The json is as follows
{
lollol
}
I think the json might be the culprit.
I cannot find the reason for [object Object] to be the variable value.
Can I use Fetch to get a hosted text file? I tried - couldn't get it work. - just thinking of an alternative.
More From » html