Q: Putting load into variable a quick question, how can I put the content of a loaded file into a JavaScript variable?
function myfunc(){
    $('.layer').load('content.txt');
}

I can access it with div class="layer", of course, but how can I also pass the result to a variable?
Thanks in advance!

A: I imagine this is what you want:
var content = "";
$('.layer').load("./content.txt", function(responseText, textStatus, XMLHttpRequest) {
    content = responseText;

    /* do stuff with content */
});


A: Quick answer:
var plainText = $('.layer').content();

