Ajax webshop首先显示没有css的html页面500毫秒

时间:2016-08-17 10:38:00

标签: javascript jquery html css ajax

我正在建立一个ajax在线网上商店。一切进展顺利,但我有一个恼人的问题。每次我指向一个我使用ajax的页面(反复重复javascript)我首先得到一个没有CSS的html页面。只是h1,H2,p标签..

我搜索了它但却找不到任何东西..这是我的产品页面的代码:

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Melkerhei</title>

    <link rel="shortcut icon" href="../../assets/ico/favicon.ico">
    <!-- Bootstrap core CSS -->
    <link href="bootstrap/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="bootstrap/jumbotron.css" rel="stylesheet">
 </head>

<html lang="en">
    <div id="header"></div>
    <div id="adminLvl" style="display: none;">false</div>
    <body onload="var k1=window.setTimeout('getCurrentUser(\'get\');', 0); var k2=window.setTimeout('getStock();', 100);">
     <div id=navbar></div>  
         <div class="container" >
        <h1>Products</h1>
          <div id="row" class="row" >   

             </div>
               <div id="cart" class="col-md-3 col-md-offset-3" style="width:400px; float:right; margin-left:0; display: none;">
               <h3>Shopping cart</h3>
               <table id="cartTable" class="table table-bordered">
                  <tr>
                    <th style="text-align: center">Aantal producten</th>
                    <th style="text-align: center">Totale prijs</th>
                  </tr>
                  <tr>
                     <td id="amount" style="text-align: center">0</td>
                     <td id="price" style="text-align: center">0</td>
                   </tr>
              </table>
              <button onclick="location.href='shoppingcart.html';" id="myButton"  class="btn btn-default btn-primary" style="margin-bottom:50px;">Meer details!</button>
            </div>
         <div id="footer"  style="clear:both;"></div>
     </div> 

     <!-- Bootstrap core JavaScript ================================================== -->

     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">     </script>
    <script src="bootstrap/bootstrap.min.js"></script>
    <script src="javascript/user.js"></script>
    <script src="javascript/stock.js"></script>
    <script src="javascript/search.js"></script>
    <script src="javascript/shop.js"></script>
    <script src="javascript/logout.js"></script>
    <script> 
    $(function(){
       $("#header").load("header.html"); 
       $("#navbar").load("navbarsearch.html"); 
       $("#footer").load("footer.html"); 
    });
    </script> 
    <script type="text/javascript"> 
    function setName() {
        var user = document.getElementById("currentUser");
        document.getElementById("userLabel").value =     user.childNodes[0].textContent;            
    }
    </script> 
  </body>
 </html>

0 个答案:

没有答案