Want to replicate a Random Meal Generator that I found online, but don't want to obviously copy the code

I want to know how would I go about finding an api that generates random food recipes.I don’t want to “cheat” by looking at this developers code to find the API

What do you suggest that I do?

Here is this link to the original code:

https://codepen.io/FlorinPop17/full/WNeggor

And here is to the link to my code so far that I am trying to replicate:

https://codepen.io/noblegas/pen/NWGjXpm

Update. My Api that i use isn’t generating any API data in the console.I am using AJAX. Here is my code.

const button=document.querySelector(".btn");
const recipe=document.querySelector('.recipe')


button.addEventListener('click',function(e){
    e.preventDefault();
    let xhttp=new XMLHttpRequest();
    xhttp.onreadystatechange=function(){
        if(this.readyState==4 &&this.status==200){
            const data=JSON.parse(this.responseText);
            console.log(data.value);

        }
    };

    xhttp.open("GET","https://www.themealdb.com/api/json/v1/1/random.php",true);
    xhttp.send();


})

I am getting undefined in the console each time.

https://codepen.io/noblegas/pen/NWGjXpm

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums