2015-02-07 37 views

回答

3
$.get('makemeastring.html').then(function (data) { 
    console.log(data); 

}).fail(function() { 
    // Error occurred, handle it here 

}); 

jQuery的​​函數將數據放入DOM元素。你不想那樣,所以.get()會沒事的。

http://api.jquery.com/jquery.get/

+0

謝謝!當我嘗試在chrome中運行時,我總是得到.fail的東西。 – 2015-02-07 23:05:11

+0

@BryanTan然後有什麼是錯的。不確定如何爲您提供幫助,因爲只有您可以看到JavaScript控制檯出現錯誤,網絡選項卡可能會出現網絡請求錯誤。你需要告訴我們錯誤是什麼。 – Brad 2015-02-07 23:05:53

+0

「XMLHttpRequest無法加載blahblahfilepath/makemeastring.html。交叉源請求僅支持協議方案:http,data,chrome,chrome-extension,https,chrome-extension-resource。」 – 2015-02-07 23:14:01

相關問題