2015-11-23 64 views
-8

因此,當運行它時它不起作用 控制檯日誌:「XMLHttpRequest無法加載file:/// C:/Users/Filip/Desktop/load/demo_test.txt。只支持交叉原點請求用於協議方案:http,數據,chrome,chrome擴展,https,chrome擴展資源。「Jquery加載函數不工作初學者

「demo_text.txt」是: 「這是外部文本!」

的到來是:

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> 
    <meta name="description" content=""> 
    <meta name="author" content="Filip "> 
    <title>Site Name</title> 
    <!--Title icone--> 
    <link rel="icon" href="http://www.axgig.com/images/97388478166848785489.png"> 
    <!--Bootstreap style--> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/ zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous"> 

</head> 
<body> 
    <div class="container text-center"> 
     <h1 class="well">Jquery .load()</h1> 
      <div class="col-sm-6 col-sm-offset-3"> 
       <div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div> 
       <button>Get External Content</button> 
      </div> 
    </div> 

    <!-- Bootstrap core JavaScript 
    ================================================== --> 
    <!-- Placed at the end of the document so the pages load faster --> 
    <!--jQuery--> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 
    <!--Bootstrap Scripts--> 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/ eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script> 
    <!--========Script fot this page========--> 
    <script> 
    $(document).ready(function(){ 
     $("button").click(function(){ 
      $("#div1").load("demo_test.txt"); 
     }); 
    }); 
    </script> 

</body> 
</html> 
+3

請仔細閱讀[問]和[編輯]你的問題進行改進。 –

+1

所以你要我去github並閱讀代碼,並找到錯誤(不知道錯誤是什麼),這意味着,時間消耗我=/...只是發佈問題,並解釋發生了什麼,以及什麼錯誤/你得到的錯誤 –

+0

Ty,sorry im 3 min new here = P brb「edit」= D – Filipuis182

回答

0

請使用Firefox XMLHTTP請求鉻塊這樣不安全的內容加載