You cannot combine the previous two non-working techniques to create something that works
Don’t feel bad, everybody tries this once
function getContent() { var stuff; $.get("remote.php",function(data) { stuff = data; }); return stuff;}var newContent = getContent(); // newContent === undefined |
$.get() does not wait for the callback to finish, neither will the containing getContent function