<?php if(!empty($pro)){?>
<table class="table table-condensed">
<?php foreach($pro as $p){?>
<tr>
<td width="80px"><img class="img img-responsive" src="<?php echo base_url();?>assets/images/products/<?php echo $p->img;?>"></td>
<td><h4><?php echo $p->title;?></h4><button type="button" class="btn btn-xs btn-default addtopack" id="<?php echo $p->pid;?>">Add To Pack</button></td>
</tr>
<?php }?></table>
<script>
$(".addtopack").click(function(){
	var id=$(this).attr("id");
	$(this).closest("tr").remove();
	$("#search").val("");
	$.ajax({
				 type: "POST",
				 url: '<?php echo base_url();?>admin/ajax_addtopack',
				 data: {id:id},
				 success: function(res){
					$("#added").after(res);
					}
				 }); 
});
</script>
<?php }?>