I'm a beginner and I'm creating a simple `CRUD` system using `AngularJS` and `Laravel 5`. I'm having problems implementing/making the `UPDATE` feature (to edit data) work. Every time I run it, I keep getting this error on my browser console:

> 
> No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<http://mycrudapp-kkoyao.c9users.io>' is therefore not allowed access. The response had HTTP status code 500.\*
> 
> 
> 

Here is my code for my html/form:
---------------------------------

```
    <body>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js"></script>
<div ng-app="addApp" ng-controller="addController">

        <h2>Edit Account</h2>

        <h4 class="modal-title" id="myModalLabel">Please fill in details</h4>

        <div class="modal-body">
            <form name="frmAccounts" ng-submit="submitForm(Account.id)" class="form-horizontal" novalidate="">

                <div class="form-group error">
                    <label for="inputEmail3" class="col-sm-3 control-label">Account Holder's Name</label>
                    <div class="col-sm-9">
                    <input type="text" class="form-control has-error" id="name" name="name" placeholder="Enter First and Last Name" 
                    ng-model="Account.acctName" ng-required="true">
                    <span class="help-inline" 
                    ng-show="frmAccounts.name.$invalid && frmAccounts.name.$touched">Name field is required.</span>
                    </div>
                </div>

                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-3 control-label">Bank Account Number</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="acctNum" name="acctNum" placeholder="Enter Bank Account Number" 
                            ng-model="Account.acctNum" ng-required="true">
                            <span class="help-inline" ng-show="frmAccounts.acctNum.$invalid && frmAccounts.acctNum.$touched">Please check your Bank Account Number.</span>
                        </div>
                </div>

                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-3 control-label">Bank Account Type</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="acctType" name="acctType" placeholder="Savings or Checking Account"  
                            ng-model="Account.acctType" ng-required="true">
                            <span class="help-inline" ng-show="frmAccounts.acctType.$invalid && frmAccounts.acctType.$touched">Please indicate bank account type.</span>
                        </div>
                </div>

                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-3 control-label">Bank Account Current Balance </label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="acctBalance" name="acctBalance" placeholder="Enter current balance"  
                            ng-model="Account.acctBalance" ng-required="true">
                            <span class="help-inline" ng-show="frmAccounts.acctBalance.$invalid && frmAccounts.acctBalance.$touched">Check Bank Account Balance</span>
                        </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary" id="btn-save" ng-disabled="frmAccounts.$invalid">Save Account</button>

                </div>
            </form>
        </div>
  </div>

 <script included here, see below>
</body>
</html>

```

Then here is my AngularJS script (included in the body tag, below of my html page):
-----------------------------------------------------------------------------------

```
    <script>

     // Defining angularjs application.
    var app = angular.module('addApp', []);
    // Controller function and passing $http service and $scope var.
    app.controller('addController', function($scope, $location, $http, $log, $window) {

        var url = $location.absUrl();
        $scope.url = $location.absUrl();

        $http.get(url + "/api")
        .then(function (response) {$scope.Account = response.data;}); //this part is working

        $scope.submitForm = function(id) {
        // Posting data to php file
        $http({
          method  : 'POST',
          url     : 'https://mycrudapp-kkoyao.c9users.io/api/accounts/' + id,
          data    : $scope.Account, 
          headers : {'Content-Type': 'application/x-www-form-urlencoded'} 
        })

          .success(function(response) {
            console.log(response);  
            location.reload();

        }).error(function(response) {
            console.log(response);
            alert('This is embarrassing. An error has occured. Please check the log for details');
        });

    });

</script>

```

The GET Method at the beginning is working fine and the data is fetched and displayed on the forms. 

But when I click the "Save" Button to call the `submitForm()` function in my script, nothing happens and I get the error (see above) on my browser console (`Chrome`). But this script was edited and came from my `CREATE` a new entry feature, and was working fine. So I'm not sure what is the problem.

Anyway, here are my `Laravel` codes: 

Laravel Route:
--------------

```
Route::post('/api/accounts/{id}', 'AccountCtrl@update');

```

Laravel Controller:
-------------------

```
 public function update(Request $request, $id) {

    $account = Account::find($id);

    $account->acctName = $request->input('acctName');
    $account->acctNum = $request->input('acctNum');
    $account->acctType = $request->input('acctType');
    $account->acctBalance = $request->input('acctBalance');
    $account->save();

}

```

I think the problem is in my `Laravel` controller, but not really sure how to fix it. 

Also, how do I fix the code for `DELETING` data?

I'm sorry for this long, messy post, but it is my first time here and I really need help on this. Thank you very much.