2011-06-01 48 views
0

Hello ppl我在集成colorbox時遇到了一些問題,然後是這樣的,我有一個代碼將數據加載到列表中,數據加載後我只需點擊標題進行編輯,通過這個插件顏色框加載編輯形式到這裏沒事,關閉它再重新加載數據的顏色框後,如果您嘗試編輯另一個項目他不會讓這樣的錯誤:jQuery e ColorBox

 $.colorbox is not a function 
[Parar Neste Erro] onClosed: function() { 

我當前的代碼是這樣的:

$("a[href*='#tabsDadosSoftware']").click(function() { 
    CarregarDadosSoftware(); 
}); 

function CarregarDadosSoftware() { 
    $.ajax({ 
     url: 'ajax/Software.php', 
     cache: false, 
     data: "acc=Visualizar&idpc=<?php echo (int)$_GET["id"]; ?>", 
     type: 'GET', 
     contentType: "application/x-www-form-urlencoded; charset=utf-8", 
     beforeSend: function() { 
      $('div#ListagemSoftware > div.Informacoes .load').show(); 
      $('div#ListagemSoftware > div.Informacoes > ul').html(""); 
     }, 
     success: function (result) { 
      $('div#ListagemSoftware > div.Informacoes .load').hide(); 
      $('div#ListagemSoftware > div.Informacoes > ul').html(result) 
     } 
    }); 
} 
$("div#ListagemSoftware > div.Informacoes > ul > li > .titulo").live('click', function() { 
     var IDSoftware = $(this).parent().attr("id"); 
    $.colorbox({ 
     href: "ajax/Software.php?acc=Editar&idpc=<?php echo (int)$_GET["id"]; ?>&id="+IDSoftware, 
     onClosed: function() { 
           CarregarDadosSoftware(); 
     } 
    }); 
}); 

現在在YouTube上留下一個視頻與錯誤演示

http://www.youtube.com/watch?v=AXOG5nec8_M

問候

回答

0

我的選擇將是要麼此: 網址: 'AJAX/Software.php',

或者這樣: HREF:「AJAX/Software.php? acc = Editar & idpc = & id =「+ IDSoftware

正在打開一個包含指向jQuery的腳本塊的文件。由於您使用的是ajax(而不是使用iframe對其進行沙箱處理),因此最近加載的jQuery版本會替換原始文檔的jQuery版本。 jQuery的第一個版本使用colorbox插件進行了擴展,當它被替換時,$ .colorbox丟失了。

既然你已經在你的原始文件中有jQuery,你不需要通過ajax加載的標記中的另一個副本。