Skip to content

Instantly share code, notes, and snippets.

View archisman-panigrahi's full-sized avatar

Archisman Panigrahi archisman-panigrahi

View GitHub Profile
function getZipCode(location, callback) {
//If it's a woeid, we bypass the first step
if ($.isNumeric(location)) {
woeid_request(location, callback)
//If they use a normal location
} else {
$.get("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.places%20where%20text%3D%22" + encodeURIComponent(location) + "%22&format=xml", function(locationData) {
// Gets the WOEID && Caches Location Name
var woeid = $(locationData).children().children().children().first().children().filterNode("woeid").text()
localStorage.typhoon_location = $(locationData).children().children().children().first().children().filterNode("name").text()