我正在使用colorbox来替换thickbox,我在所有其他脚本中都取得了成功,但是我有一个实例来执行我的所有代码,但它不会关闭颜色框。提前感谢您的帮助!
以下是代码:
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> </td> <td>' + primary_site_text + '</td> <td> </td> <td>' + listing_id + '</td> <td> </td> <td>' + add_ons + '</td> <td> </td> <td>' + scrape_calendar_text + '</td> <td> </td> <td> </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??
});
}
答案 0 :(得分:0)
您正在调用错误的功能。
应该是
$.colorbox.close();
没有第一个'()';
答案 1 :(得分:0)
尝试改变:
$.colorbox.close();
到
$.fn.colorbox.close();