Angularjs Http Post Method
home
Run
screen_rotation
fullscreen
cloud_download
<!DOCTYPE html> <html lang="en"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script> </head> <body ng-app="myApp"> <div ng-controller="registerController"> <form action="javascript:void(0);"> <h2>Register Form</h2> <div> <label>Name</label> <input type="text" ng-model="name" placeholder="Name" required="required" style='margin-left: 10px;'> </div> <div> <label>Email</label> <input type="text" ng-model="email" placeholder="Email" required="required" email="email" style='margin-left: 10px;'> </div> <div> <label>Phone</label> <input type="phone" ng-model="phone" placeholder="Phone"> </div> <button ng-click='Register()' style='margin-top:15px'>Register</button> </form> <table> <tr><th>Id</th><th>Name</th><th>Email</th><th>Phone</th></tr> <tr><td colspan="4" style="font-size:10px;color:green;">{{message}}</td></tr> <tr ng-repeat="data in usersData"> <td>{{data.id}}</td> <td>{{data.name}}</td> <td>{{data.email}}</td> <td>{{data.phone}}</td> </tr> </table> </div> <script type="text/javascript"> var app = angular.module('myApp', []); app.controller('registerController', function($scope, $http) { $scope.Register = function() { $http.post("http://tutorialsplane.com/runtest/json/registerUsers.php",{'name': $scope.name,'email': $scope.email,'phone': $scope.phone}) .success(function(response) {$scope.usersData = response.users;$scope.message = response.message;}); }; }); </script> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script> </head> <body ng-app="myApp"> <div ng-controller="registerController"> <form action="javascript:void(0);"> <h2>Register Form</h2> <div> <label>Name</label> <input type="text" ng-model="name" placeholder="Name" required="required" style='margin-left: 10px;'> </div> <div> <label>Email</label> <input type="text" ng-model="email" placeholder="Email" required="required" email="email" style='margin-left: 10px;'> </div> <div> <label>Phone</label> <input type="phone" ng-model="phone" placeholder="Phone"> </div> <button ng-click='Register()' style='margin-top:15px'>Register</button> </form> <table> <tr><th>Id</th><th>Name</th><th>Email</th><th>Phone</th></tr> <tr><td colspan="4" style="font-size:10px;color:green;">{{message}}</td></tr> <tr ng-repeat="data in usersData"> <td>{{data.id}}</td> <td>{{data.name}}</td> <td>{{data.email}}</td> <td>{{data.phone}}</td> </tr> </table> </div> <script type="text/javascript"> var app = angular.module('myApp', []); app.controller('registerController', function($scope, $http) { $scope.Register = function() { $http.post("http://tutorialsplane.com/runtest/json/registerUsers.php",{'name': $scope.name,'email': $scope.email,'phone': $scope.phone}) .success(function(response) {$scope.usersData = response.users;$scope.message = response.message;}); }; }); </script> </body> </html>
Copyrights@tutorialsplane.com