Access variable outside jQuery
I am reading the content of a text file using get.
The question is how to access that content outside jQuery function.
The code is:
- var dt = null;
- $.get('myfile.txt', function(data, status) {
- dt = data;
- alert("alert 1 = " + dt);
- }, "html");
- alert("alert 2 = " + dt);
the first alert shows the correct content of the file, but the second one shows NULL.
What shall i do in order to get the content file outside jQuery?
Sorry if this question is too simple/obvious.
Thanks a lot for your time.