?Briella 2011-06-01 08:45 采纳率: 0%
浏览 31

jQuery e ColorBox

Hello ppl I'm having a little problem in integrating colorbox , then is this , I have a code that loads the data into a list, after the data loaded I can just click on the title to edit, the edit form to be loaded by this plugin colorbox till here all right , after closing the colorbox it reloads the data again, and if you try to edit another item he 's not let this error :

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

My current code is this :

$("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();
        }
    });
});

And now leave a video on youtube with the demonstration of error

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

Greetings

  • 写回答

1条回答 默认 最新

  • 谁还没个明天 2011-06-02 06:06
    关注

    My bet would be that either this: url: 'ajax/Software.php',

    Or this: href: "ajax/Software.php?acc=Editar&idpc=&id="+IDSoftware

    Is opening a file that contains a script block pointing to jQuery. Since you are using ajax (instead of sandboxing it with an iframe), the recently loaded version of jQuery replaces your original document's version of jQuery. That first version of jQuery was extended with the colorbox plugin, when it is replaced, $.colorbox is lost.

    Since you already have jQuery in your original document, you don't need another copy in the markup you are loading through ajax.

    评论

报告相同问题?

悬赏问题

  • ¥30 软件自定义无线电该怎样使用
  • ¥15 R语言mediation包做中介分析,直接效应和间接效应都很小,为什么?
  • ¥15 Jenkins+k8s部署slave节点offline
  • ¥15 微信小游戏反编译后,出现找不到分包的情况
  • ¥15 如何实现从tello无人机上获取实时传输的视频流,然后将获取的视频通过yolov5进行检测
  • ¥15 WPF使用Canvas绘制矢量图问题
  • ¥15 用三极管设计一个单管共射放大电路
  • ¥15 孟德尔随机化r语言运行问题
  • ¥15 pyinstaller编译的时候出现No module named 'imp'
  • ¥15 nirs_kit中打码怎么看(打码文件是csv格式)