Debabrat Sharma Debabrat Sharma - 5 days ago 6
AngularJS Question

posting data from angular ui to laravel backend

I am trying to post data from angular side that is kept as a separate package and not included inside laravel framework but I am unable to get the data in laravel backend.If I use get method in the laravel route then it works and I get the response in angular side from laravel but when I use post method I don't,it displays error.Can anyone help me ?

Error in Console

response error

Answer

Go to app/Http/Middlewar/VerifyCsrfToken

protected $except = [
        'urlfinal',
        'api/*',
]

define all your routes which you want to be csrf token bypass inside except array as I described or define a prefix in your routes as api and add the line 'api/*'

Comments