Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

169
Vistas
save link content on variable

I want to get object from this link:
http://api.weatherapi.com/v1/current.json?key=281c886ff27d4f7cb57182453221607&q=Tehran&aqi=no
I wanna save it on variable.

I wanna do it all on javascript (frond-end). I don't want Node.js Code.
for example save it like this:

const my_weather = {
location: {
...
},
...
};

i wanna use it on my html page

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

JavaScript

The Fetch API provides a JavaScript interface for accessing and manipulating parts of the HTTP pipeline

const url = 'http://api.weatherapi.com/v1/current.json?key=281c886ff27d4f7cb57182453221607&q=Tehran&aqi=no';

fetch(url)
  .then((response) => {
    console.log(response);
  });

jQuery

If jquery is allowed, you can use getJSON to do it

const url = 'http://api.weatherapi.com/v1/current.json?key=281c886ff27d4f7cb57182453221607&q=Tehran&aqi=no';

$.getJSON(url, response => {
  console.log(response);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda