2016-04-22 43 views
1

我在显示外部页面的数据的索引页面div,数据显示,但不是CSS样式。 CSS样式添加到两个页面上,但文本正常显示。Css风格不加载在php的AJAX页面

<script type="text/javascript"> 
$(document).ready(function() { 
    $('#not').load('job-notification2.php'); 

    $("<link/>", { 
     rel: "stylesheet", 
     type: "text/css", 
     href: 'assets/css/oneui.min.css' 
    }).appendTo("head"); 
}); 
</script> 

究竟应该如何样子:enter image description here

而且它的外观:enter image description here

更多信息: 索引包含:

<ul class="dropdown-menu dropdown-menu-right"> 

           <div id="not"></div> 
<ul> 

作业notification2.php包含:

<li style="padding:5px" class="hidden-sm hidden-xs"> 
<a href="#"><i class="fa fa-exclamation"></i> 
No notifications </a> 

</li> 
+0

你检查CSS规则实际上匹配在加载数据的东西吗? –

+0

你的意思是assets/css/oneui.min.css?这是正确的@MarcB – Webgen

+0

在文档准备好之后,DOM浏览器实际上是否对进行了更改? – DaveK

回答

1

在作业通知页面,即添加新的风格:

.xyz { 
display: list-item; 
text-align: -webkit-match-parent; 
line-height: 1.42857143; 

} 
.xyz a{ 
display: block; 
padding: 7px 12px; 
clear: both; 
font-weight: normal; 
line-height: 1.42857143; 
color: #333; 
white-space: nowrap} 
.xyz a:hover{ 
background-color: #f9f9f9 
color: #262626; 
text-decoration: none; 
background-color: #f5f5f5 
} 


<li class="xyz"> content </li> 

问题是与外部CSS。

将需要

脚本:

<script type="text/javascript"> 
$(document).ready(function() { 
      $('#not').load('job-notification2.php');}); 
</script> 
+1

令人惊叹。非常感谢 – Webgen