I'm trying to learn how to do javascript promises. I am aiming to have a button run a function which displays the promise result of another function. This is how far I have got from tutorials:
function myfunction() {
    var post = ajaxrequest();
    post.done(function (r) {
        console.log(r);
    });
}
function ajaxrequest() {
    console.log("hello");
    $.ajax({
        url: "https://jsonplaceholder.typicode.com/todos/1",
        dataType: 'json',
        data: {
        },
    });
};
The error I am getting is:
Uncaught TypeError: Cannot read property 'done' of undefined
    at myfunction (indexboll.html:11)
    at HTMLInputElement.onclick (indexboll.html:6)
I'm really confused though. Why is it it can't read the property of done?
 
     
    