M
M
Maxim Zolotoy2019-05-12 15:13:24
AJAX
Maxim Zolotoy, 2019-05-12 15:13:24

How can I make ajax requests to api from frontend (separate domain) to backend (laravel)?

I just recently started learning Laravel - tell me how to set up interaction between the frontend and backend via api? As far as I understand, ajax requests cannot be made so simply from another domain.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav, 2019-05-12
@spacenear

Put corses on the lara https://github.com/barryvdh/laravel-cors, in the file routes/api.php write routes to
use axios on the front https://github.com/axios/axios
There are a lot of articles on this topic in the internet
https ://codeburst.io/api-authentication-in-laravel...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question