2012-07-07 25 views
0

代码不显示我的PHP元素,我想知道为什么。用AJAX显示单独的PHP文档

这里是我使用的HTML:

<div class="tablocation"> 

    <ul class="css-tabs"> 
     <li><a class="current" href="/wp-content/themes/blue-and-grey/uni-general.php">General</a></li> 
     <li><a href="/wp-content/themes/blue-and-grey/uni-courses.htm">Courses</a></li> 
     <li><a href="/wp-content/themes/blue-and-grey/uni-inthearea.htm">In the area</a></li> 
     <li><a href="/wp-content/themes/blue-and-grey/uni-sportsandfacilities.htm">Sports & facilities</a></li> 
    </ul> 

    <div class="clear"></div> 

    <div class="css-panes"> 
     <div style="display:block"></div> 
    </div> 

就拿首先,对于单general.php - 这将不加载,但其他文件为的.htm会加载。只要它是一个PHP文档,它就不会。

另外 - 下面是我用来加载文档的脚本。

<script> 
    $(function() { 
     $("ul.css-tabs").tabs("div.css-panes > div", { 
     effect: 'ajax', 
     onBeforeClick: function(event, i) { 
     // get the pane to be opened 
     var pane = this.getPanes().eq(i); 

      // only load once. remove the if (...){ } clause if 
      // you want the page to be loaded every time 
     if (pane.is(":empty")) { 
      // load it with a page specified in the tab's href 
      // attribute 
      pane.load(this.getTabs().eq(i).attr("href")); 
     } 
     } 
    }); 
    }); 
</script> 

我可以提供PHP文件,如果需要但要公平我不认为这是问题所在。

+0

哪些选项卡是您使用 – 2012-07-07 12:11:53

+0

“将不会加载” 插件 - 在JavaScript控制台中的任何错误?空的内容? 404? – JJJ 2012-07-07 12:11:54

+0

我没有空的内容,它是:http://www.jquerytools.org/demos/tabs/ajax-history.html#ajax1.htm – 2012-07-07 12:29:01

回答

0

从标准插件功能看起来不太自定义。

只加载标签页$("ul.css-tabs").tabs();

使用jQuery UI,不管你有href将通过AJAX加载的标签。

*Fetch external content via Ajax for the tabs by setting an href value in the tab links.*

http://jqueryui.com/demos/tabs/#ajax

+0

我试过了,它会很高兴地加载内容时,它是一个HTM文件 - 只是不是一个PHP文件,只是加载我的标签显示然后im即不同的页面。这不是我以后.. – 2012-07-07 12:27:02

+0

任何想法是为什么它不工作? – 2012-07-07 13:47:21

+0

在我的答案中初始化插件准系统,看它是否有效。 – 2012-07-07 20:20:26