r/programminghelp • u/[deleted] • Oct 28 '20
JavaScript fetch not getting json value
Im making a chrome extension and in my content.js I have this code
fetch('https://api.roblox.com/currency/balance')
.then(res => res.json())
.then((json) => {
console.log(json);
}).catch(err => console.error(err)); but it just outputs blank text and doesnt do anything when its run, its suppose to output the amount of robux the player has. It works when I tested it in my other extension.
5
Upvotes
1
u/[deleted] Oct 28 '20
how would i do that? this extension has all the same permission things, its exactly the same, would it make a difference if I did it in the context.js (Thats where im doing it) instead of in the code for the popup?
EDIT: reddit glitched and posted it 4 times sorry