Load text as a variable

I am able to load text into a div created dynamically w/jquery.
However. I’d like to create a variable loading the same file,

var text = .load("content/textContent.txt"); //not working of course, why i am here.

Then extract the numbers of paragraphs from it, so i can use the numbers in a for loop. for example, was thinking

for (i=0; i<text.p.lenght; i++0);

Of course so far am having some difficulty w/this. Could i get some advice please?
thx
D

You want to use jQuery’s $.get() method to fetch the file, and the contents will be passed to the success callback function as the first argument.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.