The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

how to send param from api to slim

Athrun's Avatar

Athrun

18 Aug, 2015 02:38 AM

my from .html
<form name="myForm" >
    <label>
       User name:
       <input type="text" ng-model="here.id" >
    </label>
<button ng-click="getlogin(here)">Click!!!!</button>

app .js
$scope.getlogin = function (here) {
    console.log(here.id);
    $http.get('api/login'+here.id).success(function(data,status){
$scope.std = data;
$scope.status=status;
})
        .error(function (data) {
          $scope.error = status;
        })
    }

slim
$app->get('/login/:id','getLogin');
$app->run();
  function getLogin($id) {
    
  $sql="SELECT * from std where id=$id";
  echo json_encode(getConnection()
        ->query($sql)
        ->fetchAll(PDO::FETCH_OBJ)
    );
    
}

error 404 not found, help pls

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac