/    Sign up×
Community /Pin to ProfileBookmark

Weather using JSON

Question…..So I have a website in which I used the json weather javascript code to display weather…up near the top:

[URL=”http://www.apartmenthotelmiamibeach.com/”]weather[/URL]

I tried it on our other website but it failed miserably..It’s supposed to be above the “our hotels” image. All you see is text…not even the correct weather text:

[URL=”http://www.southbeachgroup.com/”]other website[/URL]

The javascript is near the bottom:

<script type=”text/javascript”>
setTimeout(function(){
$.jsonp({
type: ‘get’,
url: ‘http://ws.geonames.org/findNearByWeatherJSON?lat=25.7902778&lng=-80.1302778‘,
dataType: ‘jsonp’,
callbackParameter: “callback”,
error: function(xhr, status, error) {
$(‘#weather’).hide();
},
success: function(data) {
$(‘#weather span’).html( (data.weatherObservation.clouds == ‘n/a’ ? ‘clear’ : data.weatherObservation.clouds) + ‘ and ‘ + Math.round( (1.8 * parseFloat(data.weatherObservation.temperature)) + 32) + ‘&#176;’);
}
});
}, 1000);
</script>

Can anyone tell me why it is not working? ?

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@FangNov 17.2010 — Seeing similar weather text in both sites.
Copy linkTweet thisAlerts:
@grimmylinaauthorNov 17.2010 — If you give the 1st page a few seconds it changes.....

"Currently few clouds and 73°"


The 2nd page stays at..

"Currently broken clouds and 55°"
Copy linkTweet thisAlerts:
@aj_nscNov 17.2010 — Your second page doesn't have the jquery library on it. This script requires jquery to run.
Copy linkTweet thisAlerts:
@grimmylinaauthorNov 17.2010 — That would be this line?

<script type="text/javascript" src="weather/jquery.js"></script>


It hasn't changed.....Do you think that some of the other javascript might be causing it not to work?

[URL="http://www.southbeachgroup.com/"]Not changing

[/URL]
Copy linkTweet thisAlerts:
@aj_nscNov 17.2010 — So.....if you go to www.southbeachgroup.com/weather/jquery.js

hint, hint...

You must be actively working on this...I accessed the page a minute ago and saw that line, but it's not there anymore.
Copy linkTweet thisAlerts:
@grimmylinaauthorNov 17.2010 — Yup, I gave up on it a few hours ago....I did that little Flash on instead.

Maybe it's better....that hint flew right over my head ?
Copy linkTweet thisAlerts:
@aj_nscNov 17.2010 — It's not a problem, the solution was simple. You don't have the jquery script on your page. You left in the line

<script type="text/javascript" src="weather/jquery.js"></script>

But that's a dead URL.

If you had to replace it with a url to jquery...such as:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>

Then your script would've worked fine.
Copy linkTweet thisAlerts:
@grimmylinaauthorNov 17.2010 — Oh yeah!!!! You are right. I tested it....Thank you, thank you, thank you!!!!! ?
×

Success!

Help @grimmylina spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...