php - Angularjs http.delete is not working after deploying project on server -
i working on laravel5.1 project. while working on localhost using xampp http.delete
works fine after hosting project on remote server delete option not working though other properties working fine. here portion of code
$scope.removesaletemp = function(id) { $http.delete('api/saletemp/' + id). success(function(data, status, headers, config) { $http.get('api/saletemp').success(function(data) { $scope.saletemp = data; }); }); }
'api/saletemp/' goes saletempapicontroller
public function destroy($id) { saletemp::destroy($id); }
view part:
<tr ng-repeat="newsaletemp in saletemp"> <td>@{{newsaletemp.item_id}}</td><td>@{{newsaletemp.item.item_name}}</td><td>@{{newsaletemp.item.selling_price | currency}}</td><td><input type="text" style="text-align:center" autocomplete="off" name="quantity" ng-change="updatesaletemp(newsaletemp)" ng-model="newsaletemp.quantity" size="2"></td><td>@{{newsaletemp.item.selling_price * newsaletemp.quantity | currency}}</td><td><button class="btn btn-danger btn-xs" type="button" ng-click="removesaletemp(newsaletemp.id)"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button></td> </tr>
note , code works fine on localhost (xampp) fails after deploying in server.
may calling wrong url. think trying call www.example.com/api/saletemp/1. instead calling www.example.com/something/api/saletemp/1 url. make sure using correct url put $http.delete('/api/saletemp/' + id)
.
may help.