I have a file and I want to get string from that file into my javascript, so I can do something with it. I have found a way to do it, but it is little bit broken, since string from file can be really large. This is what I use now:
var text;
$( "#p1" ).load( "smejanje.html" );
text = $("#p1").text();
In html:
<p id="p1"> Text </p>
And... It works (kind of), I use intervals, stuff like that, but it seems to do the trick. But, problem is that this method sets text of p1 element to be string from file and then it gets text of p1. Is there any way to load DIRECTLY to string, without editing html element?