2012-03-21 69 views
3
$(".eventName").click(
     function() { 
      var eventId = $(this).attr('id'); 
      var role = $(this).attr('dir'); 
      var todo = 'viewDetails'; 
      $("#details").load("plugins/company_calendar/calendar.php?eventId="+ eventId +"&todo="+ todo +"&role="+ role); 
      $(this).find('.eventDetails').css("left", $(this).position().left + 20); 
      $(this).find('.eventDetails').css("top", $(this).position().top + $(this).height()); 
      $(".eventDetails").fadeIn(10); 
     } 
    ); 

是否可以將我加載的數據添加到細節中?我可以在同一時間在Jquery中使用Append和Load函數嗎?

回答

1

對不起加載只是用結果替換元素的內容。

你應該做

$.get("plugins/company_calendar/calendar.php?eventId="+ eventId +"&todo="+ todo +"&role="+role, function(response) { 
    $("#details").append(response); 
}); 
0

,或者你可以做這樣的事情:

$("#details").append($("<div id='appender1'></div>")); 
$("#appender1").load("plugins/company_calendar/calendar.php?eventId="+ eventId +"&todo="+ todo +"&role="+ role); 
當然,如果你需要使用它們不止一次你需要算上附加目的地的

+1

no id解決方案:var appender = $(「

」).appendTo(「#details1」); appender.load( 「/ foo.php嗒嗒= QWERT?」);' – frumbert 2012-03-21 09:12:38

相關問題