I'm currently facing a mental block.
My goal is to fetch JSON data using the Youtube API.
The error message I am encountering is "Cannot read property 'getJSON' of undefined". Here's the code snippet I have provided:
<script>
export let videoData = {};
const { HEADING, HEADING2, SERVICE_LIST } = videoData;
import { onMount } from "svelte";
var key = 'my api key';
var url = 'https://www.googleapis.com/youtube/v3/channels';
var channelid = 'my channel id';
var options = {
part: 'snippet',
key: key,
id: channelid,
maxresults: 20
};
loadvids();
function loadvids(){
this.getJSON(url, options, function(data){
console.log(data);
});
}
</script>
This code snippet is located inside a .svelte file. Any assistance on resolving this issue would be highly valued.