开发者

jQuery e ColorBox

开发者 https://www.devze.com 2023-03-10 02:35 出处:网络
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 for

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开发者_JAVA技巧.com/watch?v=AXOG5nec8_M

Greetings


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号