Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- header('Access-Control-Allow-Origin: *');
- header( 'Access-Control-Allow-Headers: Authorization, Content-Type' );
- starter.factory('CommonFactory', function($http) {
- var base= 'your api file url';
- return {
- //with POST data method
- login_function: function(user, pass) {
- return $http({
- url: base,
- method: 'POST',
- headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
- data: postData,
- });
- },
- // With GET data method
- login_function: function(user, pass) {
- return $http({
- url: base+ '?username='+user+'&password='+pass,
- method: 'GET',
- headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
- });
- },
- }
- });
- CommonFactory.login_function($scope.user,$scope.pass)
- .success(function(res) {
- // success handling
- })
- .error(function(result) {
- //error handling
- })
- PHP Fatal error: uncaught error: call to undefined function utf8_encode()
- sudo apt-get install php7.0-xml
- sudo service apache2 restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement