nab.js // the javascript for angular db connectivity
/** * Created by HOME on 4/18/2016. */ var app = angular.module('myapp',[]);app.controller('mycontroller',function($scope,$http){ $scope.insertdata=function(){ var req1 = { method: 'POST', url: 'http://localhost/angular/ANGULAR_WITH_DB_AND_MYSQL/insert.php', headers: { 'Content-Type': undefined }, data: { 'un1': $scope.un, 'pw1': $scope.pw } } $http(req1).then(function(){ console.log("Inserted . . "); }, function(){console.log("Some Problem i think ");}); //Second Request.. $http.post("http://localhost/angular/ANGULAR_WITH_DB_AND_MYSQL/select.php").success(function(data){ $scope.proj=data; console.log(data); }) } });
No comments:
Post a Comment