ajax CORS trouble

how to handle?

before your scripts, set a variblevar token = "{{ csrf_token }}";,
then add headers: { 'X-CSRFTOKEN': ${token} }, in your ajax request
then code run well~👏