1
getWeather= async e =>{
  e.preventDefault()

  const {city,country}=e.target.elements
  const cityValue=city.value
  const countryValue=country.value
  const API_URL = `https://samples.openweathermap.org/data/2.5/weather?q=${cityValue},${countryValue}&appid=${WEATHER_KEY}`
  const response = await fetch(API_URL);
  const data = response.json()
}

NO puedo traer un servicio me da un error por consola de los CORS

2
  • me da error por consola de: has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. el 25 may. 2019 a las 22:52
  • eso casi siempre es error del servidor que no acepta conexiones de productos cruzados el 27 may. 2019 a las 16:06

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

Examina otras preguntas con la etiqueta o formula tu propia pregunta.