Question

I'm Using this plugin: Simple Weather on my site to get the weather tied into a simple widget I'm building.

All I need to do is display a more in depth location from the postcode. Currently, if I console log the 'result' object in it's source code, I only have three options for location.

In the each function from the plugin, I have added this:

console.log(result);

Within this big object, I can see a location object, which has these values:

location: Object
    city: "Sydney"
    country: "AS"
    region: ""

I'd like it if I could get the state, PROPER suburb/city, postcode. Current'y I have entered in a postcode of 2250 for Australia, Sydney is NOT the city for that postcode.

Is there's something I can add in to retrieve this data?

Here's what I'm using to instantiate simple weather.

    $.simpleWeather({
        zipcode: '2250', //Gosford
        //woeid: '2357536',
        location: 'Australia',
        unit: 'c',
        success: function(weather) {
            $('#imageThumbnail').html('<img src="'+weather.image+'" width="110" >');
            $('#degree .degree').html(weather.temp+'&deg; ');
            $('.minmax .min').html('MIN: '+weather.low+'&deg;' + weather.units.temp);
            $('.minmax .max').html('MAX: '+weather.high+'&deg;' + weather.units.temp);            
            $(".weather .content").slideDown().closest('.weather').find('.loading').remove();                        
        },
        error: function(error) {
            $(".weather").html('<p>'+error+'</p>');
        }
    });
Was it helpful?

Solution

The issue seems to be that you can't set the zipcode and the location. Location overrides the zipcode so it is not being used at all and is just searching Australia. I can't see if/how YQL allows Aussie post codes so don't know what you can put there.

If you are just getting data for the one place, try using a woeid (woeid: '12706876', - Gosford, NSW) or searching just by location (location: 'gosford, australia',).

OTHER TIPS

There is nothing you can add to change the api response format.

The format of the api response is detailed here:

Additionally Simple Weather returns the entire response from the api for your use. Thus the format of the api response defines all possible data that it can include.

If the api response is incorrect for zipcode, you could try querying it with a location or woeid instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top