I know this has been asked before here and I've viewed several similar questions, but I'm just not getting it and could use some assistance. I'm currently reading a file in SharePoint's library via an ajax query that is executed in clientContext.executeQueryAsync(), pretty much exactly as described in SharePoint's documentation:
The problem is that, when I return the results of a successful query and print them, the result is undefined. I know this is because the query is being executed asynchronously while the console.log is not, and so the value isn't set when the console.log occurs. I also have heard that adding a callback is the solution here, but I'm not that familiar with callbacks and my attempts to implement that solution here have been unsuccessful. Can anyone offer any guidance?