Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Display Past 6 hrs Weather Report with their different list

Posted on by 932

Recently i am using the below code for display the weather report but i want to display the past 6 hours weather report also with currently status of weather. What type of changes i have to do to display past 6 hrs weather report also.

<html><head>

<title>Weather API</title>

<script src="..//WebResources//new_jquery"></script><meta><meta><meta><meta><meta><meta><meta><meta><meta><meta><meta></head><body style="word-wrap: break-word;">

<div id="showWeatherForecast"></div>

<script type="text/javascript">

$(function() {

var city = window.parent.Xrm.Page.getAttribute('new_address1_city').getValue();
if(city!=null){

console.log('city', city)

var key = '5c9c57526e87675e29e6dc4028ccb393';

$.ajax({

url: 'api.openweathermap.org/.../weather',

dataType: 'json',

type: 'GET',

data: {q: city, appid: key, units: 'imperial'},

success: function(data){

var wf = '';

$.each(data.weather, function(index, val){

wf += '<p><b>' + data.name + "<b><img src=openweathermap.org/.../w"+ val.icon + ".png></p>" +

data.main.temp + '°F' + ' | ' + val.main + ", " +

val.description

});

$("#showWeatherForecast").html(wf);

},

error: function error(data) {

console.log(data);

}

})
}
else
{
document.write("Address (City) Information Unavailable");
}
});

</script>

</body></html>

*This post is locked for comments

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans