1

我正在使用 colorbox 替换thickbox,并且我在所有其他脚本中都取得了成功,但是我有一个实例,我的所有代码都在执行,除了它不会关闭 colorbox。预先感谢您的帮助!

这是代码:

    function submit_data () {
        var primary_site = $('#primary_site').val();
        var primary_site_text = $('#primary_site option:selected').text();
        var rental_unit = $('#id', top.document).val();
        var id = $('#id').val();
        var mgdc = $('#mgdc:checked').val();
        var scrape_calendar = $('#scrape_calendar:checked').val();
        var listing_id = $('#listing_id').val();
        var exp_date = $('#exp_date').val();
        var last_cost = $('#last_cost').val();
        var add_ons = $('#add_ons').val();
        var notes = $('#notes').val();
        var third_party_marketing_id = <?php echo $third_party_marketing_id ?>;
        var no_scrape_calendar_text = '';
        var yes_scrape_calendar_text = 'SCRAPE';

        if (mgdc == 'on') {
            var mgdc = 1;
            var mgdc_text = 'MGDC';
        } else {
            var mgdc = 0;
            var mgdc_text = '';
        }
        if (scrape_calendar == 'on') {
            var scrape_calendar = 1;
            var scrape_calendar_text = yes_scrape_calendar_text;
        } else {
            var scrape_calendar = 0;
            var scrape_calendar_text = no_scrape_calendar_text;
        }


        $.post("ajax_add_edit_third_party_marketing.php", { third_party_marketing_id: third_party_marketing_id, rental_unit: rental_unit, id: id, mgdc: mgdc, listing_id: listing_id, primary_site: primary_site, exp_date: exp_date, last_cost: last_cost, add_ons: add_ons, notes: notes, scrape_calendar: scrape_calendar },

        function(data) { 
            var new_line_html = '<tr><td>' + mgdc_text + '</td> <td>&nbsp;</td> <td>' + primary_site_text + '</td> <td>&nbsp;</td> <td>' + listing_id + '</td> <td>&nbsp;</td> <td>' + add_ons + '</td> <td>&nbsp;</td> <td>' + scrape_calendar_text + '</td> <td>&nbsp;</td> <td>&nbsp;</td></tr>';
            var third_party_marketing_div_id = '#third_party_marketing_' + third_party_marketing_id;

            if (scrape_calendar == 1){
                $('[id="tpm_scrape"]', top.document).replaceWith(no_scrape_calendar_text);
            }

            if (third_party_marketing_id == 0){
                $('#third_party_marketing_widget_table > tbody:last', top.document).append(new_line_html);
            } else {
                $(third_party_marketing_div_id, top.document).replaceWith(new_line_html);
            }
            $.colorbox.close(); // this isn't working??
        });
}
4

2 回答 2

0

您正在调用错误的函数。

它应该是

$.colorbox.close();

没有第一个'()';

于 2013-03-07T03:42:37.263 回答
0

尝试改变:

$.colorbox.close();

$.fn.colorbox.close();
于 2013-03-07T05:20:48.653 回答