I'm trying to use GET
from an API(not mine). I test it using simple curl
it works normal, but when I try to use axios
, axios
sends OPTION
. Server only accepts GET,HEAD,POST
so its throw CORS
Any idea why axios
sends OPTION
, not GET
?
Here's my curl
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://xxxxxx'
]);
$resp = curl_exec($curl);
curl_close($curl);
?>
Here's my axios
export default {
data: {
users:[]
},
mounted(){
this.loadData();
},
methods:{
loadData:function(){
axios.get('https://xxxxxxxx')
.then(function(response){
console.log(response.data);
});
}
}
}
is it problem with the server or i miss something?