How does your url and test url look?
Laravel charts ajax and csrf
I have an api to be consumed by the same site. I am using laravel charts and want to use the api endpoints to build the datasets and use ajax to load them.
Following the laravel charts docs (https://charts.erik.cat/api_charts.html#building-the-chart) I have used their example data for now as my endpoint (api/v1/test) and set up the view exactly as their example. It fails authorisation on page load so the chart never loads.
I am guessing this is because it uses fetch() but isn't setting a csrf header but I have no idea how to inject that header in this case.
A quick test with jquery $.get() setting the jquery csrf header I am authenticated and can return the data.
Please or to participate in this conversation.