I know how to check if a video exists within a single .get, but I have no clue how to place that within another function and do stuff with it based on an if statement, which I really want to do for this handlebars approach I'm working on. Any clue how to make this work? I'm open to a different solution, but I really just want to tweak this to make it work.
function vidExists(vidId){
var check = $.get("https://www.googleapis.com/youtube/v3/videos?id=" + vidId + "&key=[key]&part=snippet", function (data) {
return data.pageInfo.totalResults;
});
if (check > 0) {
return true
} else {
return false
}
}