I am displaying following data in controller..
<?php
$i=0;
foreach($this->session->userdata('data') as $item)
{
//echo "<pre>"; print_r($item); echo "</pre>";
$query = $this->db->query("SELECT product_name FROM phppos_product WHERE
product_id='".$item['product_id']."'");
foreach ($query->result() as $row)
{
$product_name=$row->product_name;
}
echo "<tr>";
echo "<td>".$product_name."</td>";
echo "<td>".$item['quantity']."</td>";
echo "<td>".$item['unit']."</td>";
echo "<td>".$item['unit_rate']."</td>";
echo "<td><a href='javascript:void(0)' rownum='".$i."' class='remove_from_cart'><img
src='images/close.png'/></a></td>";
echo "</tr>";
$i++;
}
?>
An in view file on success of ajax...
$.post( followurl, {'product_id' :
product_id,'quantity':quantity,'unit':unit,'unit_rate':unit_rate}, function(data){
//alert(data) ;
$("#cart_details").html(data);
$("#quantity").val('');
$("#unit").val('');
$("#unit_rate").val('');
$("#add_to_cart_status").css("visibility", "hidden");
});
$(".remove_from_cart").click(function() {
alert("dsasdas");
var array_index = $(this).attr('rownum');
alert(array_index);
var followurl ='<?php echo base_url()."index.php/placeorder_ajax/remove_from_cart";?>';
$.ajax({
method: "GET",
url: followurl,
data : {'array_index':array_index}
success: function(data, status){
$("#cart_details").html(data);
}
});
});
Now I want to call another function on click of remove_from_cart class. But alert is not coming on click of remove_from_cart class. So anybody have any idea??
Note that I am displaying data in controller