When I put this link on the browser it will worked. But, When clicked on the button it will not working. What is the wrong in this code. http://localhost/youtubewebservice/shopCartProductDelete.php?cart_ID=6
$scope.delete = function(cart_ID, index) {
var params = $.param({"cart_ID":cart_ID});
console.log(cart_ID);
$http({
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
url: 'http://localhost/youtubewebservice/shopCartProductDelete.php?cart_ID=$cart_ID',
method: "GET",
data: params
}).success(function(data){
$scope.data.splice(index, 1);
});
}
<img src="img/removecart.png" ng-click="delete({{produ.cart_ID}}, $index)" style="max-height: 40px;margin-right: 15px;"/>
PHP code
<?php
$con = mysqli_connect("localhost","root","","look4com_lk");
if(isset($_GET['cart_ID'])){
$cart_ID = $_GET['cart_ID'];
$res = "DELETE FROM l4wlk_cart WHERE cart_ID='".$cart_ID."'";
mysqli_query($con, $res);
}
echo json_encode($result);
?>