Advertisement
Guest User

Untitled

a guest
Aug 15th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. header('Access-Control-Allow-Origin: *');
  2. header( 'Access-Control-Allow-Headers: Authorization, Content-Type' );
  3.  
  4. starter.factory('CommonFactory', function($http) {
  5. var base= 'your api file url';
  6. return {
  7. //with POST data method
  8. login_function: function(user, pass) {
  9. return $http({
  10. url: base,
  11. method: 'POST',
  12. headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
  13. data: postData,
  14. });
  15. },
  16.  
  17. // With GET data method
  18. login_function: function(user, pass) {
  19. return $http({
  20. url: base+ '?username='+user+'&password='+pass,
  21. method: 'GET',
  22. headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
  23. });
  24. },
  25.  
  26. }
  27. });
  28.  
  29. CommonFactory.login_function($scope.user,$scope.pass)
  30. .success(function(res) {
  31. // success handling
  32. })
  33. .error(function(result) {
  34. //error handling
  35. })
  36.  
  37. PHP Fatal error: uncaught error: call to undefined function utf8_encode()
  38.  
  39. sudo apt-get install php7.0-xml
  40. sudo service apache2 restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement