2👍
I think you should set header in server side like this(if you are using PHP):
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Allow-Headers: X-HTTP-Method-Override, Content-Type, x-requested-with, Authorization');
the key is line 2, means can access POST/GET/OPTIONS to request.
P.S. English is not my mother language hope it would help
0👍
The solution that worked for me is to add these headers to PHP:
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
header('Access-Control-Allow-Methods: GET, POST, PUT');
And following option to Vue, to pass post data to PHP:
Vue.http.options.emulateJSON = true
- [Vuejs]-How to access property with v-if when template is moved to a custom component
- [Vuejs]-How can I get selected value on the dropdown with vue.js?
Source:stackexchange.com