<?php $i=1;foreach($rates as $r){?>
<tr><td><?php echo $i;?></td>
	<td><?php echo $r->weight;?></td>
	<td width="120px"><input id="ship<?php echo $r->ship_id;?>" type="text" value="<?php echo $r->rate;?>" class="form-control" /> </td>
    <td>
    <a href="#" id="<?php echo $r->ship_id;?>" class="btn btn-xs btn-success update_rate"><i class="fa fa-refresh"></i></a>
    <a href="#" id="<?php echo $r->ship_id;?>" class="btn btn-xs btn-danger delete_rate"><i class="fa fa-trash-o"></i></a></td></tr>
<?php $i++;}?>
<script>
$(document).ready(function(){
	$(".update_rate").click(function(e){e.preventDefault();
		var id=$(this).attr("id");
		var rate=$("#ship"+id).val();
		$.ajax({
			 type: "POST",
			 url: '<?php echo base_url();?>admin/ajax_update_rate',
			 data: {id:id,rate:rate,country:"<?php echo $country;?>"},
			 success: function(res){
				alert(res);
				//$(".rate").html(res);
			 }
			 });
	});
});
</script>