I'm using colorbox to replace thickbox, and I have had success in all my other scripts, but I have one instance where all my code executes, except it won't close the colorbox. Thank you in advance for your help!
Here is the code:
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??
});
}
You are calling the wrong function.
It should be
$.colorbox.close();
Without the first '()';
try changing:
$.colorbox.close();
to
$.fn.colorbox.close();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.