Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!