const url = ‘https://weather-by-api-ninjas.p.rapidapi.com/v1/weather?city=Lucknow’;
const options = {
method: ‘GET’,
headers: {
‘content-type’: ‘application/octet-stream’,
‘X-RapidAPI-Key’: ‘763c810bdfmshb9f4669b80c3925p18d818jsn3db5be365864’,
‘X-RapidAPI-Host’: ‘weather-by-api-ninjas.p.rapidapi.com’
}
};
fetch(url, options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Aşağıya yorum ekleyerek tartışmaya katılın:
Thanks brother code is really working
thanks a lot,it did work perfectly
Thanks man, your code did the job for me.
Your code is working fine thanks!, But when i m using code snippet of js fetch it showed error why?