0

我有一个 div (#slide2),我想在其中加载其他 .php 文件的一部分(div.side 中的内容)。这是我到目前为止得到的:

function uniqueId() { return new Date().getTime() };

$(function() {  
    $("#slide2").load("content01.php?uid= .slide"+uniqueId(), function() {
        applyRestOfJqueryAfterAjaxLoads();
    )};
});

function applyRestOfJqueryAfterAjaxLoads() {
    $('#slides').superslides({
        slide_easing: 'easeInOutCubic',
        slide_speed: 800,
        pagination: true,
        hashchange: true,
        scrollabe: true
    });
});

谢谢您的帮助!

4

2 回答 2

0

试试这个代码

$(function() {  
    $("#slide2").load("content01.php #slide"+uniqueId(), function() {
        applyRestOfJqueryAfterAjaxLoads();
    )};
});

请注意,这"#slide"+uniqueId()将返回您要加载的内容的 id

于 2013-01-15T21:18:23.453 回答
0

所以我不得不在 uniqueId 之后附加选定的内容(#slide2)

使用 UniqueId 以便 IE 和其他获取最新内容,而不是缓存的内容。

function uniqueId() { return new Date().getTime() }; // So that IE gets the newest content
   $(function() { $("#slide2").load("content01.php?"+uniqueId()+" #slide", function(){
      applyRestOfJqueryAfterAjaxLoads();
      });

   function applyRestOfJqueryAfterAjaxLoads() {
   // All the code I need to re-initialise
   }
});

虽然它确实工作得很好,但这似乎是一个错误?

于 2013-01-17T01:51:09.633 回答