Member Avatar for leegeorg07

Hi again,

I'm trying to load a text file into a variable and I know of the jquery load

$("div").load("file.txt");

but I want to be able to load it into a var, does anyone know how to do this?

Thanks in advance.

Well, if you are using jQuery (and you said you are), you can do this:

var test = $.get(url).responseText;

Member Avatar for leegeorg07

so I would use
$blah = $.get("file.txt").responseText;
?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.