success
är namnet på callback
funktion och inte promise
.
Du bör använda:
$.ajax({
type: "POST",
url: "<?php echo site_url('con_product/ins_product'); ?>",
data: data,
success: function() {
alert("Products list is ready to be printed");
window.open("<?php echo site_url('con_product/print_product'); ?>","_blank");
window.open("<?php echo site_url('con_product/form_product'); ?>","_self");
}
});
Eller done
lovar:
$.ajax({
type: "POST",
url: "<?php echo site_url('con_product/ins_product'); ?>",
data: data
}).done(function() {
alert("Products list is ready to be printed");
window.open("<?php echo site_url('con_product/print_product'); ?>","_blank");
window.open("<?php echo site_url('con_product/form_product'); ?>","_self");
});