H
H
HabrDima202020-12-19 18:42:59
JavaScript
HabrDima20, 2020-12-19 18:42:59

How to load ajax data via api on laravel?

I want to upload

New Post
by api of the city and branch.
Created an ajax request for api with data output under input, for auto-completion when typing a city name and address in the input! But on laravel such a problem
jquery-3.5.1.min.js:2 POST https://api.novaposhta.ua/v2.0/json/ net::ERR_FAILED

checkout:1 Access to XMLHttpRequest at 'https://api.novaposhta.ua/v2.0/json/' from origin 'http://myapp.com' has been blocked by CORS policy: Request header field x-csrf-token is not allowed by Access-Control-Allow-Headers in preflight response.

How can you decide? If I create Middleware CORS, how can I use it if I don't use the route?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Chubarov, 2020-12-20
@agoalofalife

Found the answer here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question