No' Access-Control-Allow-Origin'控制台上的错误

时间:2016-06-28 15:52:16

标签: javascript jquery json twitter-bootstrap jsonp

我正在实施Bootstrap导航栏,但它在我的控制台上显示错误

enter image description here

我试图解决我的问题,但仍然对我做错的地方感到困惑。 有谁帮我找出了我的错误?

制作mdbootstrap.com的本地副本后,我面临这些错误

enter image description here

代码

    <head>
        <meta charset="UTF-8">
        <title></title>
        <!-- Material Design Icons -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

<!-- Bootstrap core CSS -->
<link href="http://mdbootstrap.com/live/_doc/css/bootstrap.min.css" rel="stylesheet">

<!-- Material Design Bootstrap -->
<link href="http://mdbootstrap.com/live/_doc/css/mdb.min.css" rel="stylesheet">

<!-- SideNav slide-out button -->
<a href="#" data-activates="slide-out" class="navbar-brand button-collapse"><i class="material-icons">menu</i></a>
<!--/. SideNav slide-out button -->


    <!-- SCRIPTS -->
    <!-- JQuery -->
    <script type="text/javascript" src="http://mdbootstrap.com/live/_doc/js/jquery.min.js"></script>

    <!-- Bootstrap core JavaScript -->
    <script type="text/javascript" src="http://mdbootstrap.com/live/_doc/js/bootstrap.min.js"></script>

    <!-- Material Design Bootstrap -->
    <script type="text/javascript" src="http://mdbootstrap.com/live/_doc/js/mdb.min.js"></script>
    <style type="text/css">
         body {
       background: url("http://mdbootstrap.com/images/regular/nature/img%20(23).jpg") no-repeat center center fixed;
       background-size: cover;
}

    </style>

    <script type="text/javascript">

    // Initialize collapse button
$(".button-collapse").sideNav();
// Initialize collapsible (uncomment the line below if you use the dropdown variation)
$('.collapsible').collapsible();

    </script>
    </head>
<!-- Sidebar navigation -->
<ul id="slide-out" class="side-nav admin-side-nav dark-side-nav">
<!-- Side navigation links -->
<ul class="collapsible collapsible-accordion">
<li><a href="#intro" class="waves-effect waves-light"><i class="fa fa-home"></i> Home</a></li>
            <li><a href="#" class="waves-effect waves-light"><i class="fa fa-money"></i> Sales</a></li>
            <li><a href="#" class="waves-effect waves-light"><i class="fa fa-line-chart"></i> Conversion</a></li>
            <li><a href="#" class="waves-effect waves-light"><i class="fa fa-users"></i> Website Traffic</a></li>
            <li><a href="#" class="waves-effect waves-light"><i class="fa fa-search"></i> SEO</a></li>
            <li><a href="#" class="waves-effect waves-light"><i class="fa fa-share-alt"></i> Social</a></li>
        </ul>
        <!--/. Side navigation links -->

    </ul>
    <!--/. Sidebar navigation -->

    <!--Navbar-->
    <nav class="double-navbar navbar navbar-fixed-top unique-color z-depth-1" role="navigation">
        <div class="container-fluid">
            <div class="navbar-header pull-left">
                <!-- SideNav slide-out button -->
                <a href="#" data-activates="slide-out" class="button-collapse"><i class="fa fa-bars"></i></a>
                <!--/. SideNav slide-out button -->

            </div>

            <!-- Navbar Icons -->
            <ul class="list-inline pull-right text-center">
                <li><a href="#" class="waves-effect waves-light" data-toggle="modal" data-target="#contact-form"><i class="fa fa-question"></i><br><span>Help</span></a></li>
                <li><a href="#" class="waves-effect waves-light" data-toggle="modal" data-target="#contact-form"><i class="fa fa-cogs"></i><br><span>Settings</span></a></li>
                <li><a href="#" class="waves-effect waves-light" data-toggle="modal" data-target="#contact-form"><i class="fa fa-sign-out"></i><br><span>Logout</span></a></li>

            </ul>
            <!--/. Navbar Icons -->
        </div>
    </nav>
    <!--/.Navbar-->
    <div class="container">
        <div class="space-50" style="height: 300px"></div>
        <h1 class="white-text">Scorll Down</h1>
        <div class="space-50" style="height: 900px"></div>
    </div>

1 个答案:

答案 0 :(得分:2)

这似乎是http://mdbootstrap.com的CORS问题。

你可以:

  1. 如果可能,请尝试使用其他CDN网址。

  2. 使用从http://mdbootstrap.com

  3. 下载的本地副本