My problem is that I'm using the google maps directions API and use axios to make the request, but when I execute the code it tells me that I'm not passing the origin parameter but if I'm passing it on, I'll try to pass it on the parameter from the beginning in the params object but nothing, I already use the url with https and only with http, I'm doing my tests in a localhost. in the end I will put the error that I get.
function directions(origen, destino){
axios.get('http://maps.googleapis.com/maps/api/directions/json?',{
params:{
origin:origen,
destination:destino,
key:'mi clave ;)'
}
})
.then(function(response){
console.log(response)
})
.catch(function(error){
console.log('Ha problemas willies');
})
}
directions("ecatepec","CDMX")
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' link ' is therefore not allowed