Please help me through this m trying from many days to learn basic crud operations in angularjs I just got output for display table data(using $http.get) next am trying to perform delete but m getting CORS error. yes, but the record gets deleted successfully.
my code igniter function is like this:
public function delete_user($user_id){
header('Content-Type: application/json;charset=UTF-8');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: DELETE, HEAD, GET, OPTIONS, POST,
PUT');
header('Access-Control-Allow-Headers: Content-Type, Content-Range, Content-
Disposition, Content-Description');
$this->users_model->delete_user($user_id);
redirect('Users/index');
}
controller function in angularjs:
$scope.delete = function(id)
{
$http.delete('http://localhost/**/****/*****/users/delete_user/'+ id)
.then(function(response){
$scope.userList= response.data;
});
}