jQueryでheader.html読み込んでdivのidがheaderの部分に表示させたいのですが、
上手くいきません。
html
1<!DOCTYPE html> 2<html> 3 4<head> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 <title>たいとる</title> 7 <meta name="description" content=""> 8 <meta name="keywords" content=""> 9 <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.css"> 10 <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> 11 <link rel="stylesheet" href="/css/default.css"> 12 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 13 <script> 14 $(function() { 15 $("#header").load("header.html"); 16 }); 17 </script> 18</head> 19 20<body> 21 <div id="header"></div> 22 23 ああああああああ 24</body> 25</html> 26
header.htmlは文字が書いてあるだけのファイルです。
表示させようとすると、
「ああああああああ」が一瞬移った後に真っ白な画面になってしまいます。
chromeとIEで確認しましたが、
両方共表示されなかったのでソースの問題なのかなと思います。
どの部分が誤ってるのご教授お願い致します。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。