//console.log(result); $("#newPreparation").val(""); swal({ title:'Congrats!', text:'Inventory Preparation has been added', type:'success' }, function(){ location.reload(); }); }); }); <?php foreach ($ro4->list_inventory_preparation_preparationNo() as $preparationNo) { ?> $("#removeBtn<?php echo $preparationNo; ?> ").click(function(){ $.post("inventory-preparation-remove.php",{preparationNo:'<?php echo $preparationNo; ?> '},function(){ swal({ title:'Wow!', text:'Inventory Preparation has been Deleted', type:'error' },