Codemirror Import text with jquery
===

i have the following function using the codemirror. 

        function app() {
            jQuery.get('http://localhost:2748/foo.txt', function (data) {
                alert(data);
            });
            alert(data);
            editor.setValue(data);
        }

The alert displays the textfile data but when i assign them to the editor are not displayed. If i for example i make a new var t="test"; and then editor.setValue(t); then it Works!. Any help pls? 