I'm ridiculously new to Javascript. I am able to fetch a page and access the resulting JSON when using console.log but I do not now how to then access the JSON to save variables. I have tried with no luck to find the right direction myself online.
{"video":"ads/003.mp4","rpv":0.004776,"id":"0001"}
function fetchAd() {
fetch('https://www.****/getAd.php')
.then((res) => res.json())
.then((data) => console.log(data.video))
.catch((error) => console.log(error))
}
What do I need to learn to access JSON to save variable?