0
我在使用jquery $ .get獲取文本文件。我有以下代碼。jquery .get返回奇數結果
console.log("before the get");
$.get("testfile.txt", function(data){
console.log("in the get");
console.log(data);
});
console.log("after the get");
在控制檯中,我希望看到
before the get
in the get
'...the data...'
after the get
相反,我得到
before the get
after the get
in the get
'...the data...'
爲什麼我收到的奇次?謝謝。
'.get()'是異步的,所以它在處理過程中繼續執行,而腳本的其餘部分繼續執行 – j08691
face palm - thanks much j08691 –