Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery加载函数不起作用初学者_Jquery_Load - Fatal编程技术网

Jquery加载函数不起作用初学者

Jquery加载函数不起作用初学者,jquery,load,Jquery,Load,所以当我运行它时,它不工作了 控制台日志:“XMLHttpRequest无法加载file:///C:/Users/Filip/Desktop/load/demo_test.txt. 跨源请求仅支持协议方案:http、数据、chrome、chrome扩展、https、chrome扩展资源。“ “demo_text.txt”是: “这是外部文本和外部文本!” 结果是: <!DOCTYPE html> <html lang="en"> <head> <

所以当我运行它时,它不工作了 控制台日志:“XMLHttpRequest无法加载file:///C:/Users/Filip/Desktop/load/demo_test.txt. 跨源请求仅支持协议方案:http、数据、chrome、chrome扩展、https、chrome扩展资源。“

“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>

站点名称
Jquery.load()
让jQuery AJAX更改此文本
获取外部内容
$(文档).ready(函数(){
$(“按钮”)。单击(函数(){
$(“#div1”).load(“demo_test.txt”);
});
});

请使用Firefox xmlhttp request作为chrome阻止此类不安全内容加载

请阅读您的问题并加以改进。因此,您希望我去github阅读代码,并找到错误(不知道错误是什么),这意味着我需要花费大量时间=/…只需发布问题,并解释发生了什么,你得到的是什么错误/错误,对不起,我3分钟新到这里=P brb“编辑”=D