aman
aman

Reputation: 75

Cross-Origin Request Blocked: ....(Reason: CORS header ‘Access-Control-Allow-Origin’ missinG

I'm working on yeoman angular generator (frontend) and laravel (backend)

Controller function

public function store(Request $request)
    {
     //Wat to write here
    }
service file

  .service('registerservice', function ($http, EnvironmentConfig ) {
  function register(user) {
      
        return $http({
               url: EnvironmentConfig.api + 'api/v1/register',
               method: 'post',
                data : $httpParamSerializerJQLike(user)           
               })
                ;}
        return {
            register: register       
        };
  });

ERROR:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at localhost/angular/blog/public/index.php/api/v1/register. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing)

How to solve this problem?

Upvotes: 3

Views: 1217

Answers (0)

Related Questions